Part 31 AngularJS page refresh problem

当在本地服务器上浏览学生列表并点击进入学生详情页面后,若使用CTRL+F5或CTRL+R刷新页面,学生详情将消失。本文介绍如何通过在index.html头部添加<base href=/>元素来解决此问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

What is the issue : When you navigate to http://localhost/students, you will see list of students as shown below 

Resource interpreted as Stylesheet but transferred with MIME type texthtml 

Click on any student name. For example when you click on Mark, you will see mark details and the URL in the address bar is http://localhost/students/1


angularjs html5mode refresh 404 

At this point if you refresh the page by pressing CTRL + F5 or CTRL + R, the student details disappear and the page will be renedered as shown below. 

angularjs routing refresh 

To see the errors, launch the Browser Developer Tools by pressing F12

angularjs refresh page 404 

To fix this issue all you have to do is place the <base href="/"> element just below the<title> element in the head section of index.html page. 

转载于:https://www.cnblogs.com/gester/p/5494404.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值