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

后端 未结 7 1376
盖世英雄少女心
盖世英雄少女心 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条回答
  •  -上瘾入骨i
    2021-01-31 14:20

    PLEASE NOTE:

    I would like to mention a few things that the above answers are not addressing.

    RxJs is a standalone library, and for that matter its operations are standalone methods as well. map, filter etc are operator methods that are not accessed through an object. Remember that you import them seperately.

    So for example you cannot import { filter} and want to access it through the router object. That will never work because a router object is an angular specific class instance somewhere in the API's. Angular provides a pipe() method that allows you to register methods that must be chained in the process before moving to the next method within the router that aren't part of the router object.

    ALWAYS REMEMBER THAT

提交回复
热议问题