I'm facing an issue with observable.from(). I have an array of ID's and for each ID I need to perform an async operation and return a value.
I want after all of the ID's complete their inner async operation to get the value of all of them together (Not one by one).
This is my code:
Observable.from(IDs)
.mergeMap(ID=> this.getDataByID(ID)
.map(data => Observable.of(Object.assign({}, data, dataUpdate[ID]))))
.subscribe(newData=> {
...
})
The dataUpdate is an object from outside of this scope witch hold data I want to append to the object fetched by getDataByID().
In this case the subscriber been called for every event ID and newData contains the data for only one ID.
Can I make the newData to hold an object/array of all of the data instead of one by one?
Thanks.