I found a workaround, still hoping that someone would come up with something more complex, as this fragment should be placed in each component.
It is placed in the constructor and checks if the new route is part of the delegating component. If so, redirect to another route.
_location.subscribe(loc => {
let routeOfDelegatingComponent = "....";
if (loc.url === routeOfDelegatingComponent) {
router.navigate(['/acustomroute']);
}
});
Matt source
share