AngularJS:angular-ui-router state.go失败

时间:2015-04-19 18:46:34

标签: angularjs angular-ui-router ionic-framework

在Ionic-angular应用程序中,我打电话:

   $state.go("main.crudlist");

并在回复中遇到以下异常:

Error: Could not resolve 'entry' from state 'main'
    at Object.transitionTo (angular-ui-router.min.js:3074)
    at Object.go (angular-ui-router.min.js:3007)
    at angular-ui-router.min.js:4057
    at angular.min.js:138
    at e (angular.min.js:40)
    at angular.min.js:44

该条目应该是什么意思?

这是州声明:

$ stateProvider         .state(' login',{             url:' / login',             templateUrl:' Content / Mobile / templates / login.html',             控制器:' LoginController'         })

    .state('settings', {
        url: '/settings',
        templateUrl: 'Content/Mobile/templates/settings.html',
        controller: 'SettingsController'
    })

    // setup an abstract state for the tabs directive
      .state('main', {
          url: "/main",
          templateUrl: "Content/Mobile/templates/main.html",
          abstract: true,
          controller: 'MainController'
      })


    .state('main.home', {
        url: '/home',
        views: {
            'main': {
                templateUrl: 'Content/Mobile/templates/home.html',
                controller: 'HomeController'
            }
        }
    })


   .state('main.settings', {
       url: '/settings',
       views: {
           'main': {
               templateUrl: 'Content/Mobile/templates/settings.html',
               controller: 'SettingsController'
           }
       }
   })

.state('main.crudlist', {
    url: "/crudlist",
    views: {
        'main': {
            templateUrl: "Content/Mobile/templates/crudlist.html",
            controller: 'CrudListController'
        }
    }
})

1 个答案:

答案 0 :(得分:1)

最后,它与角度无关,而与离子html声明本身无关。

我有:

<a ui-sref="entry" class="item" ng-repeat="leaf in menuleafs()" ng-click="loadApplication(leaf)">{{leaf.title}}</a>

将其切换为:

<a class="item" ng-repeat="leaf in menuleafs()" ng-click="loadApplication(leaf)">{{leaf.title}}</a>

诀窍。

抱歉,我没有提供足够的信息