Error rxjs_Observable__.Observable.forkJoin is not a function?

后端 未结 4 594
情深已故
情深已故 2021-02-05 10:25

I am using Rxjs in an angualr-cli application.

in viewer.component.ts

    //Other Imports
    import { Observable } from \'rxj         


        
4条回答
  •  没有蜡笔的小新
    2021-02-05 10:43

    As explained here, you have two options:

    1. Either import all operators as a single package
    2. Or import each operator individually

    In the first case you would use import like this:

    import Rx from 'rxjs/Rx';
    
    Rx.Observable.forkJoin(1,2,3)
    

    In the second like this:

    import { Observable } from 'rxjs/Observable';
    import 'rxjs/add/observable/forkJoin';
    

    I believe what you're looking for is the second option.

提交回复
热议问题