Observable forkJoin not firing

后端 未结 5 734
暗喜
暗喜 2020-12-18 19:21

I\'m trying to user forkJoin on two Observables. One of them starts as a stream... If I subscribe to them directly I get a response, forkJoin isn\'

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-18 20:01

    A very common problem with forkJoin is that it requires all source Observables to emit at least one item and all of them have to complete.

    In other words if this.statuses$ or this.companies$ doesn't emit any item and until they both complete the forkJoin won't emit anything.

    this.statuses$.subscribe(
        res => console.log(res),
        undefined,
        () => console.log('completed'),
    );
    

提交回复
热议问题