Issue
I need to fix this nested subscriptions , but i have some difficulties :-( could you help me please to find a solution?
combineLatest([stream1,stream2])
.pipe(takeUntil(this.destroyed$))
.subscribe({
next: ([a, b]) => {
this.extService.get(a,b).subscribe();
},
});
Solution
In this case you would have to use switch map after, this way it will "change" to the new subscription
combineLatest([stream1,stream2])
.pipe(
takeUntil(this.destroyed$),
switchMap(([a,b])=>this.extService.get(a,b)
)
)
.subscribe(
(responseFromExtService) => { // your code}
);
Make sure you know also the difference between combine lastest and fork join
Answered By - Caio Oliveira
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.