无法解析状态 angularjs

cannot resolve state angularjs

我在尝试从我的应用程序中的一种状态转到另一种状态时遇到错误。

我在索引文件中定义了所有状态。

index.js

var MyModule = angular.module('myApp.ui.moduleTest', [
  'ui.router'
])
.config(function($stateProvider, modalStateProvider){
  $stateProvider

    .state('myApp.dashboard.appArea.moduleTest',
      modalStateProvider.create({
        animation: true,
        name: 'myApp.dashboard.appArea.moduleTest',
        url: 'apps/moduleTest',
        controllerAs: 'moduleTestCtrl',
        controller: 'ModuleTestCtrl',
        windowClass: 'semi-modal semi-modal--huge',
        templateUrl: function() {
          return 'app/ui/apps/moduleTest/widget.html';
        },
        resolve: {
          //Some function to retrieve data
        }
      })
    )
    .state('myApp.dashboard.appArea.moduleTest.wizards',
      modalStateProvider.create({
        animation: true,
        name: 'myApp.dashboard.appArea.moduleTest.wizards',
        url: 'apps/moduleTest/runWizard',
        controllerAs: 'moduleTestWizardCtrl',
        controller: 'ModuleTestWizardCtrl',
        templateUrl: function(){
          return 'app/ui/apps/moduleTest/wizard.html';
        }
        // resolve: {
        //
        // }
      })
    )
})

当我处于状态 "myApp.dashboard.appArea.moduleTest" Fron ModuleTestCtrl 我试图进入状态 "myApp.dashboard.appArea.moduleTest.wizards" 但我收到错误 "could not resolve state"。我如何将此配置模块导入我的控制器以导航到该状态?

/*jslint node: true */
'use strict';

var angular = require('angular');

function ModuleTestCtrl($uibModalInstance, Api, diagnosticsRaw,  myService, $state) {

  this.$uibModalInstance = $uibModalInstance;
  this.Api = Api;
  this.dataRaw = diagnosticsRaw;

  this.parserData = function(indexes) {
      //Some app logic irrelevant
  }

  myService.setPropertyToRun(this.dataRaw);
  myService.setIsPropertyToRun(true);

$state.go('myApp.dashboard.appArea.moduleTest.wizards'); //THIS IS WHERE I HAVE MY PROBLEM

  };
}

ModuleTestCtrl.$inject = ['$uibModalInstance', 'Api', 'diagnosticsRaw', 'myService', '$state']; module.exports = ModuleTestCtrl;

您是否在 angular.config 中描述了 myApp.dashboard.appArea.moduleTestmyApp.dashboard.appArea.moduleTest.wizards 的所有父状态,如果没有,则可能是问题所在。

示例:
wizards 是 moduleTest 的子项,moduleTest 是 appArea 的子项,appArea 是 dashboard 的子项,dashboard 是 myApp 的子项,你明白了。您首先需要声明所有这些父状态,即使它们可能什么都不做。

更多关于 ui-state 的信息:
https://github.com/angular-ui/ui-router/wiki/Nested-States-and-Nested-Views