I am faced with a scenario where I have two observables - observableA
and observableB
.
My goal is to create an observable that triggers only after both observableA
and observableB
have completed. Additionally, I want to subscribe to observableB
only once observableA
has finished.
Although I attempted the following code snippet, it subscribes to both observableA
and observableB
simultaneously:
forkJoin(observableA, observableB).subscribe(([resultA, resultB])=>{
// ...
})
To achieve the desired outcome, I had success with this alternative approach:
observableA.subscribe(resultA => {
observableB.subscribe(resultB => {
// ...
})
})