我一直在尝试使用路线ActivatedRoute模块从指定路线获取辅助路线。 e.g
当前网址:http://localhost:4200/dashboard/contraceptives/(assessment:5991780301d88a211e86e012//details:599062793f86454d43896255)
出口:
<div class="col m4 z-depth-3">
<router-outlet name="details"></router-outlet>
</div>
<div class="col m4 z-depth-3">
<router-outlet name="assessment"></router-outlet>
</div>
成分:
如何在当前插座和组件中获取详细信息参数?
ngOnInit() {
this.sub = this.route.params.subscribe(params => {
this.id = params['id'];
});
}
答案 0 :(得分:-1)
我找到了办法:
constructor(router:Router){
RouterLinks.events(event=>{
// here i am subscribing to the events
const primaryRouter = event.state.root.firstChild;
// where first child is the primary router-outlet
})
}