Error rxjs_Observable__.Observable.forkJoin is not a function?

后端 未结 4 529
情深已故
情深已故 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:41

    Use the forkJoin Operator as a function by importing forkJoin instead of importing Observable.
    Use forkJoin.subscribe() in place of Observable.forkJoin.subscribe()

    import { forkJoin } from 'rxjs/observable/forkJoin'
    
    export class ViewerComponent implements OnInit, AfterViewInit, OnDestroy {
        someFunction(someArg){
          let someArray: any = [];
          forkJoin(someArray).subscribe(data => {
          });
        }
    }
    

    Source Code : https://github.com/ReactiveX/rxjs/blob/master/src/internal/observable/forkJoin.ts

提交回复
热议问题