I need your assistance to get the previous route path. I am using the below link to get that but it doesn't trigger at first time...
How to determine previous page URL in Angular?
constructor(router: Router) {
router.events
.pipe(filter(event => event instanceof NavigationEnd))
.subscribe((event: NavigationEnd) => {
console.log('prev:', event.previousUrl);
this.previousUrl = event.url;
});
}
I used both RoutesRecognized and NavigationEnd but didn't get that..
I called this method in constructor and ngOnInit but every time it doesn't trigger at first time....
is there any way, I can get that...
Thanks...