How can i get access to the routing start and routing end events? I want to show a Progress Bar while routing and loading data.
Can someone tell me how this works?
If you prefer to work with an observable:
import { Router, NavigationStart } from '@angular/router';
...
constructor(router:Router) {
router.events.subscribe(e => {
if(e instanceof NavigationStart) {
// Init Code
}
if(e instanceof NavigationEnd) {
// Exit Code
}
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With