Property 'filter' does not exist on type 'Observable'

后端 未结 7 1374
盖世英雄少女心
盖世英雄少女心 2021-01-31 13:38

Hi I am using Angular 2 final with router 3.0. I want to filter the events that are emitted from this.router.events

What I want to do :



        
7条回答
  •  醉梦人生
    2021-01-31 14:11

    UPDATE

    For RXJS 5.x version:

    import 'rxjs/add/operator/filter';

    For RXJS 6.x version:

    import { filter } from 'rxjs/operators';

    The following rules have been designed by the RxJS team to help JavaScript developers refactor import paths:

    1. rxjs/operators: Contains all pipeable operators.

    import { map, filter, scan } from 'rxjs/operators';

    1. rxjs: Contains creation methods, types, schedulers, and utilities.

    import { Observable, Subject, asapScheduler, pipe, of, from, interval, merge, fromEvent } from 'rxjs';

提交回复
热议问题