I worked around this with a little helper function. But this only works if you know the URL scheme.
function getUrlParameterByChild(searchString: string, route: ActivatedRouteSnapshot, next: boolean = false): string { let url: string = route.url[0] ? route.url[0].path : ''; if (!url && !route.parent) { throw new Error('Parameter not found in url'); } if (next) { return url; } return getUrlParameterByChild(searchString, route.parent, url === searchString); }
Using
this._router.navigate([ 'projects', getUrlParameterByChild('servers', route), 'servers' ])
source share