The BehaviorSubject filter is not a function?

Spend some time trying to understand why my pluker is not working :(

https://plnkr.co/edit/JHODQeWQtYmz4UkYzFds?p=preview

add error in next line

let load = this.actions$.filter (action => return action.type==START_LOADING); 

$ actions are defined as follows:

 private actions$ : BehaviorSubject<Action> = new BehaviorSubject<Action>({type: null, payload: null}); 

and i import this

 import { Subject } from "rxjs/subject"; import { Observable } from "rxjs/Observable"; import { BehaviorSubject } from 'rxjs/subject/BehaviorSubject'; 

in the Chrome debugger, I see that some functions are available (map, lifting, scanning, etc.), but they don’t filter.

Does anyone know why the filter is not available in BehaviorSubject? I assume this is a simple mistake, but I cannot find it;)

+5
source share
1 answer

I think you should import the filter statement:

 import 'rxjs/add/operator/filter'; 

Here is your updated plunkr with this import: https://plnkr.co/edit/37JEG4aQ7qmQuaPchB4Z?p=preview .

See this question for more information:

+11
source

Source: https://habr.com/ru/post/1242802/


All Articles