What's the best approach to transform an array and call few observable methods inside.
What I am looking for is something of this type to work:
resultArray = someArray.map(item => {
oneObs.subscribe(result1 => {
item.result1 = result1
});
secondObs.subscribe(result2 => {
item.result2 = result2
});
});
What is the best approach here? I came up only with a workaround to use the forEach loop of this kind:
someArray.forEach(item => {
Observable.forkJoin([oneObs, secondObs]).subscribe(
(results: [Result1Type, Result2Type]) => {
item.result1 = results[0];
item.result2 = results[1];
resultArray.push(item);
});
});
Any help appreciated.