I have a dashboard application which consists of a treeview component (which lists various content nodes) and a dashboard-edit component which renders some editable content
This solution worked for me: complete example.
constructor(
private readonly router: Router,
private readonly rootRoute: ActivatedRoute,
){
router.events.pipe(
filter(e => e instanceof NavigationEnd),
map(e => this.getParams(this.rootRoute))
).subscribe(params => {
//
});
}
private getParams(route: ActivatedRoute): Params {
// route param names (eg /a/:personId) must be ditinct within
// a route otherwise they'll be overwritten
let params = route.snapshot.params
params = { ...route.snapshot.queryParams, ...params}
if(route.children){
for(let r of route.children){
params = {...this.getParams(r), ...params};
}
}
return params;
}
Credits to Toxicable.