you can create CanActivate protection for the parent route, where you can stop navigation based on some global variable. This variable can have a value based on whether the animation was shown or not.
So what can you do
export class AnimationGuard implements CanActivate { canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { if(HasAnimationRun){ return true; } runAnimation(state.url); return false; } } runAnimation(url){
Read more about CanActivate here .
Hope this helps!
source share