I could not compile this code on Visual Studio Code Editor. First, I was getting an error like has no exported member 'X', X for BehaviorSubject, Subject
.
So, I changed the import statements as follows:
import { BehaviorSubject } from 'rxjs';
import { Subject } from 'rxjs';
which made the import error disappear. But, now I get the following error, while trying to compile it using tsc command:
I changed the emit to next which solved property 'emit' does no exist
error. But property 'scan' does not exist
error is still there. Which I believe has to do with the settings in .json file. But I cannot figure out what setting should be changed.
So, what do I miss here? Any help is much appreciated. If you get the code compile, could you describe how you did it.
emit
is a method that is specific to Angular EventEmitter
that currently relies on RxJS Subject
.
Since EventEmitter
was specifically designed to handle change detection it's not recommended to use as general purpose subject in Angular applications.
EventEmitter
emit
is a wrapper over subject Subject
next
method, so emit
should be replaced with next
.
scan
operator should be imported with:
import 'rxjs/add/operator/scan';
And this is already done in linked code.