如何枚举ui-router中的注册状态?状态、ui、router

由网友(山高木南)分享简介:我想知道在使用 ui-router 时是否有办法列出所有已注册的状态I'd like to know if there is a way to list all registered states when using ui-router推荐答案如果你查看最新版本 ui-router 的 $state.get()...

我想知道在使用 ui-router 时是否有办法列出所有已注册的状态

I'd like to know if there is a way to list all registered states when using ui-router

推荐答案

如果你查看最新版本 ui-router 的 $state.get() 文档,你会注意到不向函数传递任何参数应该返回一个包含所有已配置状态对象的数组.

If you look at the docs for $state.get() for the latest version of ui-router, you will notice that passing no arguments to the function should return an array of all configured state objects.

/**
 * @ngdoc function
 * @name ui.router.state.$state#get
 * @methodOf ui.router.state.$state
 *
 * @description
 * Returns the state configuration object for any state by passing the name
 * as a string. Without any arguments it'll return a array of all configured
 * state objects.
 *
 * @param {string|object} stateOrName The name of the state for which you'd like 
 * to get the original state configuration object for.
 * @returns {object} State configuration object or array of all objects.
 */
阅读全文

相关推荐

最新文章