forkJoin is deprecated: resultSelector is deprecated, pipe to map instead

前端 未结 6 2499
栀梦
栀梦 2020-12-15 02:45

I\'m working on an Angular 6 project.

Running ng lint gives the following Warning:

"forkJoin is deprecated: resultSelector is deprecated,

6条回答
  •  一个人的身影
    2020-12-15 02:54

    forkJoin should work. Which rxjs version are you using? Latest version should be doing this:

    import { of, combineLatest, forkJoin } from 'rxjs';
    import { map, mergeAll } from 'rxjs/operators';
    

    Here the working code:

    import { of, forkJoin } from 'rxjs';
    
    const observables = [of('hi'), of('im an'), of('observable')];
    
    const joint = forkJoin(observables);
    
    joint.subscribe(
      s => console.log(s) 
    )
    

    Should output:

    ["hi", "im an", "observable"]

    I tried reproducing this but I see no warning:

    https://stackblitz.com/edit/angular-v4nq3h?file=src%2Fapp%2Fapp.component.ts

提交回复
热议问题