Angular NavigationStart - Stop navigation conditionally

361 Views Asked by At

I have a case where I want to stop the navigation based on a condition in the component. Please look at the code below

if(val instanceof NavigationStart){
    if(on some condition) {
        // Stop the navigation from here
    }
}

I already have CanDeactivate which serves some other purpose of checking. In this case, I do it at the component level with the data I have currently.

Is there any way that I can use this NavigationStart to achieve my requirement.

Please help me. Thank you...

0

There are 0 best solutions below