Answer the question
In order to leave comments, you need to log in
How to hang an event handler on each NavigationEnd event in Angular?
Right now I'm handling each event like this:
ngOnInit() {
this.router.events.subscribe((event: any) => {
if (event.error) {
this.router.navigate(['/login']);
}
if (event instanceof NavigationEnd) {
console.log(event);
console.log(this);
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question