I would like to make several HTTP request asynchronously, then combine all of the response together into an array.
Something like below:
getSamples(genes) {
genes.forEach(gene => {
//This is the HTTP get request from other service which returns an observable array
this.vsal.getSamples(gene).subscribe(sampleRequest => {
//I want to join all the responses into sampleIdsSource
this.sampleIdsSource.next(sampleRequest.samples);
},
e => {
this.error.next(e);
})
});
}
What's the best way to do this?