Angular UI 路由器忽略 HTML5 模式关闭 [英] Angular UI Router ignoring HTML5 Mode off
本文介绍了Angular UI 路由器忽略 HTML5 模式关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Angular UI Router 忽略了 HTML5Mode(false),它以无法添加书签或直接登陆的方式呈现链接:
Angular UI Router is ignoring HTML5Mode(false), and it's rendering links in a way that can't be bookmarked or directly landing upon:
app.js:
$stateProvider
.state('search', {
url: '/search',
views: {
'main.wrapper': {
templateUrl: 'views/search.html',
controller: 'SearchCtrl'
},
'navbar': { templateUrl: 'views/search.navbar.html' }
});
$locationProvider.html5Mode(false);
foo.html:
<a ui-sref="search">Search</a>
成为
<a href="/search">Search</a>
它不应该检测到它不在 HTML5 模式下并返回
Shouldn't it detect it's not on HTML5 Mode and return
<a href="/#/search">Search</a>
推荐答案
如 Radim Köhler 所示,这是angular-ui-router ~0.2.11
和angular 1.3.0
之间的一个bug.
As indicated by Radim Köhler, this is a bug between angular-ui-router ~0.2.11
and angular 1.3.0
.
https://github.com/angular-ui/ui-router/issues/1397
这篇关于Angular UI 路由器忽略 HTML5 模式关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文