UI的路由器不生产的角度正确的href属性 [英] ui-router not producing correct href attribute in angular
问题描述
$ stateProvider
.STATE('管理员',{
摘要:真实,
网址:'/管理员',
模板:'<格UI的视图>< / DIV>'
})
<一个UI的SREF =admin的>联系< / A>
我得到的网址是< A HREF =/ admin的>联系< / A>
时,它的应的是 /#/管理员
- 这打破了,当我命令点击一个链接在新标签页中打开
这是一个已知的问题,报告中的错误。将固定在明年发布。这里是一个解决方法:
不可能禁用与角1.3.0-rc.3#1397
由于:
在html5mode检查中urlRouter.js [行383]不再正确。因此它是不可能禁用html5mode。
一个速战速决可能是:
块引用>VAR isHtml5 = $ locationProvider.html5Mode();
如果(angular.isObject(isHtml5)){
isHtml5 = isHtml5.enabled;
}也有是克里斯牛逼的(
UI-路由器<建议/ code>组成员)
的 - 下方看到这个 Q&放意见;一个
使用了pre-发行版本0.2.12- pre1现在。 bit.ly/UIR-0212$p$p1 ......它有一些修正为1.3.0 COMPAT。克里斯 - ŧ10月16日16:13时。
块引用>$stateProvider .state('admin', { abstract: true, url: '/admin', template: '<div ui-view></div>' }) <a ui-sref="admin">admin</a>
The url I get is
<a href="/admin">admin</a>
when it should be/#/admin
-- this breaks when I command click on a link to open in a new tab.解决方案This is a known issue, reported as a bug. Will be fixed in next release. Here is a workaround:
Impossible to disable html5Mode with angular 1.3.0-rc.3 #1397
Due to:
the html5mode-check in urlRouter.js [line 383] is no longer correct. And thus it's impossible to disable html5mode.
A quick fix could be:
var isHtml5 = $locationProvider.html5Mode(); if (angular.isObject(isHtml5)) { isHtml5 = isHtml5.enabled; }
Also there is suggestion by Chris T (
UI-Router
team member) - see comments under this Q & AUse the pre-release version 0.2.12-pre1 for now. bit.ly/UIR-0212pre1 ... it has a few fixes for 1.3.0 compat. – Chris T Oct 16 at 16:13
这篇关于UI的路由器不生产的角度正确的href属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!