I am trying to do a subscribe of observable which formed through multiple times with map operator to build that final result.
So let say If I have outer observable functionA() where we had subscribed to it,but there is functionB() : observable where data is coming through two observable and second observable is dependent to first one result, then how can we get the return the final mapped observable . please check code what I need to describe:-
functionB() : observable<any>{
return this.datastream1().map((objectA)=>{
this.datastream2(objectA).map((objectB)=>{
return [...objectA,...objectB]
})
})
}
functionA(){
this.functionB().subscribe((data)=>{
console.log(data);
})
}
So in this example while I am subscribing it then I am getting the observable in console instead of getting the spreaded data coming from both observables.
how can I make wait to resolve nested observable dependencies first while subscribing.In this scenario both observable should be resolved and then data should be returned back to subscribing function that is textfunctionA()