Я хотел бы сделать несколько HTTP-запросов асинхронно, а затем объединить все ответы вместе в массив.
Что-то вроде ниже:
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);
})
});
}
Какой лучший способ сделать это