问题
I am facing some weird issues while working with Angular 6 and Rxjs 6. When I import as below
Import { forkJoin } from 'rxjs/internal/observable/forkJoin';
I am getting issue as
but when I use import as
import { forkJoin } from 'rxjs/';
it works perfectly.
I used the same method to merge operator but when i used import as
import { merge } from 'rxjs/';
but it thrown error as above and it works fine if i use
import { merge } from 'rxjs/internal/observable/merge';
Could someone point out where is the problem? Why is this working differently?
PS: It's working on reloading page but alternately.
回答1:
Use it like this,
import { merge } from 'rxjs/operators';
Check you rxjs version, it should be 6+
Stackblitz example: https://stackblitz.com/edit/typescript-bcsl1r
回答2:
Use :
import {merge} from 'rxjs';
OR
import { merge } from 'rxjs/operators';
Refer: https://github.com/ReactiveX/rxjs/blob/master/docs_app/content/guide/v6/migration.md
来源:https://stackoverflow.com/questions/52923192/rxjs-import-issues-in-angular-6