如何枚举ui-router中的注册状态? [英] How to enumerate registered states in ui-router?

查看:18
本文介绍了如何枚举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() 文档,你会注意到不向函数传递任何参数应该返回一个包含所有已配置状态对象的数组.

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.
 */

这篇关于如何枚举ui-router中的注册状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆