Observable forkJoin not firing

后端 未结 5 725
暗喜
暗喜 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:06

    The forkJoin didn't work so I used the below code to solve my problem. With mergeMap you can map the result of the outer subscription to the inner subscription and subscribe to it as you wish

    this.statuses$.pipe(
        mergeMap(source => this.companies$.pipe(
            map(inner => [source , inner])
            )
        )
    ).subscribe(([e , r]) => {
        console.log(e , r);
    })
    

提交回复
热议问题