[已解决]angular7报错,求解:in src/app/content/content.component.ts(18,7): error TS2345

来源:3-9 改造股票管理应用

厘汨

2018-11-26

************************************************图片描述

angular7报错,求解

:in src/app/content/content.component.ts(18,7): error TS2345: Argument of type ‘MonoTypeOperatorFunction’ is not assignable to parameter of type ‘OperatorFunction<Event, Event>’.

代码有错,修改为:

 constructor(public router:Router) {
    router.events.pipe(
      filter(event=>event instanceof NavigationEnd)
    ).subscribe((event:NavigationEnd)=>{
      if(event.url==='/dashboard'){
        this.pageTitle='这里是首页';
        this.pageDesc='';
      }else if(event.url.startsWith('/stock')){
        this.pageTitle='股票信息管理';
        this.pageDesc='进行股票信息基本增删改查';
      }
    });

另外自己导包的名称不同,一个大写,一个没有大写的问题。导致出现下面的报错
WARNING in ./node_modules/@angular/Router/fesm5/router.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.

写回答

1回答

油条C

2018-11-30

//img.mukewang.com/szimg/5c00e8390001432305700370.jpg下载RXJS 5.x版本

0
0

Angular4.0从入门到实战 打造股票管理网站

Angular新特性,教你熟练使用 Angular 和 Typescript 开发组件式单页应用

2683 学习 · 1361 问题

查看课程