I have a problem with Typescript compilation. This code returns the error:
error TS2304: Cannot find name 'NavigationEnd'.
How can I make the compiler know about NavigationEnd type? NavigationEnd is angular2 router event type.
this.router.events.subscribe((e) => {e instanceof NavigationEnd ?
console.log('NavigationEnd'):console.log('Not NavigationEnd')});
I`m using IDE PHPStorm.
Seems you're missing an import
import { Router, NavigationEnd } from '@angular/router'
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