有没有办法看到已经设置在$ 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()
返回所有状态的数组。包括顶级抽象状态,但你可以过滤掉,如果你想要的。