是否有一种简单的方法可以通过路由名称获取@RouteConfig中定义的路由组件?我尝试使用下划线代码,它可以工作,但我需要知道最简单的方法.
let annotations = Reflect.getMetadata('annotations', MyApp)[0].configs;
let route = _.findWhere( annotations, {name: 'RouteName' } );
let component = route.component;
Run Code Online (Sandbox Code Playgroud)
您应该能够从中获取此信息 Instruction
router.generate(['/RouteName']).component.componentType;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
267 次 |
| 最近记录: |