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
,其中:
包含当前路径下已激活的所有子路径.
我想知道如何获得所有子级路线(还有未激活的子级路线).
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屋!
查看全文