0

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...

Ryan M
  • 18,333
  • 31
  • 67
  • 74
Sai M.
  • 2,548
  • 4
  • 29
  • 46
  • You can use `canDeactivate` to guard from navigating off of the component, for example: https://stackoverflow.com/questions/52044306/how-to-add-candeactivate-functionality-in-component . Lmk if it helped or not. –  Jun 04 '20 at 13:53
  • There are some more ways to stop navigation, which is part of routing. We probably need more context – Vega Jun 15 '20 at 04:22

0 Answers0