nginclude 添加/到主 URL

编程入门 行业动态 更新时间:2024-10-03 02:22:56
本文介绍了nginclude 添加/到主 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送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:关键词]

本文发布于:2023-04-21 17:45:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1007848.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:nginclude   URL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!