angularjs中的$state.current.name和$state.current

angularjs中的$state.current.name和$state.current,angularjs,Angularjs,我有以下运行块: app.run(function($rootScope, $ionicLoading,$location,$localStorage,$state, $timeout, $window) { $rootScope.$on('$stateChangeStart', function (event, toState, toParams, fromState, fromParams) { if($localStorage.userInfo !== null &

我有以下运行块:

app.run(function($rootScope, $ionicLoading,$location,$localStorage,$state, $timeout,
  $window) {
   $rootScope.$on('$stateChangeStart', function (event, toState, toParams, fromState, fromParams) {
       if($localStorage.userInfo !== null && toState.name !== 'Deployment' &&  $state.current.name !== 'Deployment'){
        $state.go('Deployment', {}, {reload: true});
        console.log($state);
        console.log($state.current);
        event.preventDefault();

         return;
       }

          });
带有
$state
, 它给出:

$current: extend
current: Object
name: "Deployment"
templateUrl: "templates/deployment.html"
url: "/deployment"
__proto__: Object
带有$state.current:

Object {name: "", url: "^", views: null, abstract: true}
  • 它给出了一个表示已达到10个摘要迭代的错误。我怀疑这是因为
    $state.current.name
    为空,因此条件失败

  • 2. 或者可能是因为我在statechangeStart事件中更改状态,它进入了一个循环

    如何修复此错误

    此外,当$state的当前对象具有正确的值时,为什么要在$state.current中获取空对象