5

Spend some time trying to figure out why my plunker doesn't work :(

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

error append on following line

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

actions$ is defined like this :

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 debugger of Chrome, I see that some functions are available (map, lift, scan, etc) but not filter.

Somebody know why filter is not available on BehaviorSubject ? I imagine that is a simple mistake but I don't find it ;)

Philippe sillon
  • 1,572
  • 2
  • 14
  • 20

1 Answers1

14

I think that you should import the filter operator:

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 details:

Community
  • 1
  • 1
Thierry Templier
  • 198,364
  • 44
  • 396
  • 360