为什么AngularJS复制在我的路线查询字符串? [英] Why is AngularJS duplicating the query string in my route?
问题描述
我使用基于散列的导航我AngularJS在 /
根植应用程序。
I am using hash-based navigation in my AngularJS app rooted at /
.
如果用户导航到我的应用程序是这样的:
If a user navigates to my app like this:
http://example.com/?foo
在页面加载的东西(可能角)后片刻导致地址栏看起来比我预想的不同。
A moment after the page loads, something (possibly Angular) is causing the address bar to look different than I expected.
我所看到的:
http://example.com/?foo#/?foo
我期望看到:
http://example.com/?foo#/
这是怎么回事,我可以把它关掉?
Why is this happening, and can I turn it off?
推荐答案
我敢打赌,你需要在HTML5模式不具有散列片段......虽然我不确定。
I'd wager you need to be in 'html5 mode' to not have the hash fragment... though I'm uncertain.
http://docs.angularjs.org/guide/dev_guide.services 。 $位置
$locationProvider.html5Mode(true).hashPrefix('!');
在您的应用程序的配置,你可以惹的配置参数,它很可能摆脱它。
In your app configuration, you can mess with that config param and it'd probably get rid of it.
这篇关于为什么AngularJS复制在我的路线查询字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!