Not indexed, but according to the Savkin blog, add the following to the child to get the router settings of the parent component:
constructor(activatedRoute: ActivatedRoute, router: Router) { const parentActivatedRoute = router.routerState.parent(activatedRoute); this.id = parentActivatedRoute.params.map(routeParams => routeParams.id); }
Comparing this code with what is in the Router guide , you will need to use AsyncPipe with id in your template, or you can use subscribe() ... or you can use snapshot if you are sure that the id value will not change:
this.id = parentActivatedRoute.snapshot.params['id'];
@Chris mentions in a comment below: this.router.routerState.pathFromRoot(this.route) will return an array of activated routes up to the current route. Then you can get the parameters of all activated routes.
Update : RouterState.pathFromRoot(someRoute) marked deprecated in the main . In RC.5, use ActivatedRoute.pathFromRoot() .
source share