Мне удалось заставить его работать, используя CanDeactivate guard, но на дочерних компонентах.
Пример маршрута:
{
path: 'root/foo',
component: ListComponent,
children: [
{
path: ':id',
canDeactivate: [CanNavigateToParentRouteGuard],
component: ChildComponent,
outlet: 'outlet'
}
]
},
Guard:
canDeactivate(component: ChildComponent, currentRoute: ActivatedRouteSnapshot,
currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): boolean {
return !currentState.url.startsWith(nextState.url);
}