为什么/#!/会被附加到我网站的index.php页面? (我使用角1.x)

问题描述 投票:0回答:2

我正在使用angular 1.x并且我的webapp的索引页附加了/#!/请建议可能的outlook错误。

angularjs web
2个回答
1
投票

这不是一个错误,正是预期的结果。基本上将html5mode设置为true,并将基本链接添加到索引页的头部。

$locationProvider.html5Mode(true);

<head>
    <base href="/">
</head>

本教程详细介绍:

https://scotch.io/tutorials/pretty-urls-in-angularjs-removing-the-hashtag

有关html5历史api的更多信息

http://diveintohtml5.info/history.html


0
投票

$location服务有两种配置模式,用于控制浏览器地址栏中URL的格式:Hashbang模式(默认和您在应用程序中设置)和HTML5模式,它基于使用HTML5 History API。

official docs上,您可以阅读更多相关内容并了解其工作原理。

继续摇摆!

© www.soinside.com 2019 - 2024. All rights reserved.