angularjs – 查看在ui-router中配置的状态

有没有办法看到已经设置在$ stateProvider的所有状态?

在这种情况下,我希望我的状态分配分布在许多文件。我想检查在运行或配置在不同的文件中构建的状态。

例如:

# component1.coffee
angular.module('zoo').config ($stateProvider) ->
  $stateProvider.state 'component1',url: '/component1'
    template: _template
    controller: 'Component1Ctrl'

# component2.coffee
angular.module('zoo').config ($stateProvider) ->
  $stateProvider.state 'component2',url: '/component2'
    template: _template
    controller: 'Component2Ctrl'

# componentNavigation.coffee
angular.module('zoo').run ($state) ->
  console.log 'All configured states:',$state.configuredStates # doesn't exist.

有什么东西会列出两个状态,component1和component2?

$ state.get()

返回所有状态的数组。包括顶级抽象状态,但你可以过滤掉,如果你想要的。

How to enumerate registered states in ui-router?

相关文章

ANGULAR.JS:NG-SELECTANDNG-OPTIONSPS:其实看英文文档比看中...
AngularJS中使用Chart.js制折线图与饼图实例  Chart.js 是...
IE浏览器兼容性后续前言 继续尝试解决IE浏览器兼容性问题,...
Angular实现下拉菜单多选写这篇文章时,引用文章地址如下:h...
在AngularJS应用中集成科大讯飞语音输入功能前言 根据项目...
Angular数据更新不及时问题探讨前言 在修复控制角标正确变...