Is it possible to stop router navigation based on some condition
I'm new to angular, I want stop the routing when user clicks on refresh button or back button based on some condition. I don't know whether this is possible, if anybody knows help me
constructor(private route: Router) {
this.route.events
.filter(event => event instanceof NavigationEnd)
.pairwise().subscribe((event) => {
if (expression === true){
// stop routing
} else {
// continue routing
}
});
}
Can it be possible? If yes, how can I do this?