我有一个Typescript编译问题.此代码返回错误:
error TS2304: Cannot find name ‘NavigationEnd’.
如何让编译器了解NavigationEnd类型? NavigationEnd是angular2路由器事件类型.
this.router.events.subscribe((e) => {e instanceof NavigationEnd ? console.log('NavigationEnd'):console.log('Not NavigationEnd')});
我正在使用IDE PHPStorm.
好像你错过了一个导入
原文链接:https://www.f2er.com/angularjs/140939.htmlimport { Router,NavigationEnd } from '@angular/router'