Scenario :
- Maybe it's something simple, but I can not find a solution.
- I have a service "firstService" that returns an Observable of A[]. I have a service "secondService" that is passed an object A and returns an Observable . What I want at the end is an object B[].
- Object A is different from object B.
Todo :
- I want to avoid double subscription.
I have it programmed like this,
Although I know it is not correct due to the double subscription:
this.B = [];
this.services.firstService().subscribe(
elements => {
elements.forEach (element => {
this.services.secondService(element).subscribe(s => {
this.B.push(s);
})
});
});
Which operators or combination of operators would improve the above?