如何枚举注册国UI的路由器? [英] How to enumerate registered states in ui-router?

查看:146
本文介绍了如何枚举注册国UI的路由器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一种方法使用 UI路由器时,向所有已注册国家列表

I'd like to know if there is a way to list all registered states when using 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的路由器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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