Angular 如何获取未激活的子路由 [英] Angular how to get the non activated children routes
本文介绍了Angular 如何获取未激活的子路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Angular 中,您始终可以在组件中注入 ActivatedRoute 以获取对当前激活的路由.
In Angular you can always inject ActivatedRoute in your component to get a reference to the current activated route.
它有一个属性 children
:
包含当前路由下的所有子路由激活.
Contains all the child routes activated under the current route.
我想知道如何获得所有子路由(未激活的路由也是如此).
I was wondering how can I get all the children routes (so also the non activated ones).
推荐答案
您可以使用 route.routeConfig.children
来获取路由器中定义的子项.
You could use route.routeConfig.children
to get the children defined in the router.
这篇关于Angular 如何获取未激活的子路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文