Angular js将extenssion“/#”附加到我的网址(例如http://example.com/#/),但我希望我的根方向完全干净(没有/#).
有没有办法覆盖这个以获得一个干净的主页?
答案 0 :(得分:1)
通过html5Mode
true
设置为$locationProvider
$locationProvider.html5Mode(true);
请参阅:http://docs.angularjs.org/guide/dev_guide.services.$location
答案 1 :(得分:0)
您需要配置$location
提供程序才能删除网址中的哈希#
。 This documentation介绍了如何配置html5模式。
此SO问题也有助于: Removing the fragment identifier from AngularJS urls (# symbol)
答案 2 :(得分:0)
我也遇到过这个问题。这可以通过
来实现在配置
中添加$ locationProvider.html5Mode(true)$locationProvider.html5Mode(true)
在Index.html头标记中添加基本网址
<base href="/app/index.html">