nginclude add / to the main url

孤街醉人 提交于 2019-12-24 10:50:32

问题


Any idea why this is happening?

I try to use

ng-include="'html_template'"

URL Result WITH ng-include

http://localhost/app/grid#/leave

URL Result WITHOUT ng-include

http://localhost/app/grid#leave  

Notice that the forward slash "/" is added.


回答1:


Actually there is question and answer about that

Preserve traditional anchor behavior with ng-include

In summary of that answer, ng-include requires $anchorScroll, and $anchorScroll requires $location. As long as $location is involved, it changes the normal hash to angular hasn

This is my answer to the same problem you have, https://stackoverflow.com/a/27529032/454252

Basically Angular changes the URL with ng-include because $location service is involved, and the way get around is little tricky



来源:https://stackoverflow.com/questions/27394885/nginclude-add-to-the-main-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!