AngularJS路由删除#符号解决方案
发布时间:2020-12-17 09:55:28 所属栏目:安全 来源:网络整理
导读:最近做一个web应用,有个需求需要删除angular路由中的#号。 例如: http: //example .com / http: //example .com / #/about http: //example .com / #/contact 需要改成 http: //example .com / http: //example .com /about http: //example .com /contact
最近做一个web应用,有个需求需要删除angular路由中的#号。 例如: http://example.com/
http://example.com/#/about
http://example.com/#/contact
需要改成 http://example.com/
http://example.com/about
http://example.com/contact
这个是angular默认自带的,所以想要删除需要配置一下: $locationProvider.html5Mode(true);
然后再index.html 的header中,指定一个base: <base href="/">
这就ok了,需要的通知自己尝试一下吧! (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |