尝试使用Angular.js导航路径时出现以下错误。
错误:
Error: Could not resolve 'principal.resourse.userrole' from state 'principal'
at Object.t.transitionTo (angularuirouter.js:7)
at Object.t.go (angularuirouter.js:7)
at angularuirouter.js:7
at angularjs.js:146
at e (angularjs.js:43)
at angularjs.js:45
我正在解释下面的代码。
.state('principal',{
url: '/principal',
templateUrl: 'princpalview/princpal.html',
controller: 'princpalHomeController'
})
.state('princpal.resourse', {
url: '/resourse',
templateUrl: 'princpalview/res.html',
controller: 'resPrincpalController'
})
.state('princpal.resourse.userrole', {
url: '/userrole',
templateUrl: 'princpalview/userrole.html',
controller: 'resourcePrincpaluserroleController'
})
princpal.html:
<ul class="nav navbar-nav">
<li ui-sref-active="active"><a ui-sref="princpal">Home</a></li>
<li ui-sref-active="active">
<a ui-sref="principal.resourse.userrole" >Resource Management
<span class="caret"></span></a>
</li>
</ul>
请帮我解决此错误。
答案 0 :(得分:0)
名称必须完全符合(princpal
vs principal
- 缺少一个“我”
// state name
princpal.resourse.userrole
// ui-sref call
principal.resourse.userrole