Angular 6.x Map operator not exist for Observable with ActivatedRoute

前端 未结 1 1533
萌比男神i
萌比男神i 2021-01-24 15:14

I had a problem recently, and found no tips on how to get it work. When I use ActivatedRoute in order to get data from my Routes, angular failed to compile and say Propert

相关标签:
1条回答
  • 2021-01-24 15:45

    Angular 6.x uses rxjs 6.x. In rxjs6.x, you need to chain other pipeable operators in Observable's pipe operator.

    this.route.data
              .pipe(
                 map( data => data.title)
                )
              .subscribe(title => console.log(title));
    
    0 讨论(0)
提交回复
热议问题