In my approach, I followed the code below.
this.service1.info
.subscribe(a => this.service2.getDetails(a.id)
.subscribe(b => {
this.doStuff(b);
})
);
Lately, it has come to my attention that we will be adding more steps that gradually provide additional details to the client. This leads me to anticipate the emergence of the following cumbersome pattern.
this.service1.info
.subscribe(a => this.service2.getDetails(a.id)
...
.subscribe(z => {
this.doStuff (z);
})
);
Is there an elegant way in RxJS to handle such scenarios? I am looking for a solution where an operation is performed only after all steps in the chain have been completed. I have gone through the documentation but haven't found a suitable answer. I have a feeling that the solution is there, and it's just my lack of understanding that is hindering me from finding it.