Sim*_*lGy 45 coffeescript angularjs angular-ui angular-ui-router
有没有办法看到所有已经开启的州$stateProvider?
在这种情况下,我希望我的状态分配分布在许多文件中.我想在不同的文件中run或config在不同的文件中检查构建的状态.
例如:
# 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.
Run Code Online (Sandbox Code Playgroud)
有什么东西会列出这两个州,component1并且component2?
对于尝试获取实际URL路由(包括正确显示的嵌套状态)的人:
$state.get().map(function(state) { return $state.href(state.name) })
// => ['/login', '/home', '/something']
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
23932 次 |
| 最近记录: |