'NavigationStart Event is not Firing/Triggering on refresh
I have a component that has router events like NavigationStart & NavigationEnd. While they work perfectly on visiting a new route but I am facing an issue with NavigationStart event which does not fire on refresh but NavigationEnd event do fire. Below is the code snippet. Is this a intended behavior?
navgState: NavigationStart;
constructor(private router: Router,
private activatedRoute: ActivatedRoute) {
this.router.events.subscribe((event) => {
if (event instanceof NavigationStart) {
console.log("Inside of NavgStart");
this.navState = {
id: value.id,
navigationTrigger: value.navigationTrigger,
restoredState: value.restoredState,
url: value.url
};
}
});
this.router.events.pipe(filter(value => value instanceof NavigationEnd)).subscribe((value: any) => {
this.someMethod(value);
});
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
