使用Angular.js ui-router获取状态错误

时间:2022-02-04 10:31:33

I am getting the following error while trying to navigate the path using Angular.js.

我尝试使用Angular.js导航路径时收到以下错误。

Error:

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

I am explaining my code below.

我在下面解释我的代码。

.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>

Please help me to resolve this error.

请帮我解决这个错误。

1 个解决方案

#1


0  

Names must fit exactly (princpal vs principal - one 'i' is missing)

名称必须完全符合(princpal vs principal - 一个'我'缺失)

// state name
princpal.resourse.userrole
// ui-sref call
principal.resourse.userrole

#1


0  

Names must fit exactly (princpal vs principal - one 'i' is missing)

名称必须完全符合(princpal vs principal - 一个'我'缺失)

// state name
princpal.resourse.userrole
// ui-sref call
principal.resourse.userrole