nginclude add / to the main url

2019-08-15 17:31发布

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条回答
forever°为你锁心
2楼-- · 2019-08-15 18:18

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

查看更多
登录 后发表回答