【发布时间】:2016-11-05 21:29:48
【问题描述】:
我遇到了 Typescript 编译问题。此代码返回错误:
错误 TS2304:找不到名称“NavigationEnd”。
如何让编译器知道 NavigationEnd 类型? NavigationEnd 是 angular2 路由器事件类型。
this.router.events.subscribe((e) => {e instanceof NavigationEnd ?
console.log('NavigationEnd'):console.log('Not NavigationEnd')});
我正在使用 IDE PHPStorm。
【问题讨论】:
-
你是从
@angular/router导入的吗? -
@GünterZöchbauer 谢谢。
标签: typescript angular