I have an angular 2 application, and would like to intercept route events, prevent them from happening, play an animation and then continue to route.
My thoughts are this
if I have a class
export class SomeComponent {
constructor(private router: Router){
router.events.subscribe(evt => {
if(evt instanceof NavigationStart){
//I would like to cancel the event here the first time, and then
//play an animation, after the animation is done, trigger the router
//to go to the original route it wanted to.
}
})
}
}
Is there a way to stop that router from finishing the navigation process?
?showAnimationto the URL and everytime a url change happens, it checks if that flag is there, and if so, does an animation before moving to the original route's address?