问题描述
限时送ChatGPT账号..知道为什么会这样吗?
我尝试使用
ng-include="'html_template'"
URL 结果 WITH ng-include
URL Result WITH ng-include
http://localhost/app/grid#/leave
URL 结果 WITHOUT ng-include
URL Result WITHOUT ng-include
http://localhost/app/grid#leave
注意添加了正斜杠/".
Notice that the forward slash "/" is added.
推荐答案
其实就是有问必答
使用 ng-include 保留传统锚点行为
总而言之,ng-include 需要 $anchorScroll,而 $anchorScroll 需要 $location.只要涉及到$location,就把普通的hash改成angular has
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
这是我对您遇到的相同问题的回答,https://stackoverflow/a/27529032/454252
This is my answer to the same problem you have, https://stackoverflow/a/27529032/454252
基本上 Angular 使用 ng-include 更改 URL,因为涉及 $location 服务,并且绕过的方式有点棘手
Basically Angular changes the URL with ng-include because $location service is involved, and the way get around is little tricky
这篇关于nginclude 添加/到主 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论