I'm looping through an array of objects (called projects). The forEach loop contains a service call that returns an observable. I'm trying to wait to process the next project in the array until the observable within the loop completes. What should I use? I tried forkJoin already.
projects
.forEach(project => {
this.imageService.getProjectImages(project.projectId.toString(), true, true, undefined)
.catch(err => observer.error(err))
.finally(() => {
// process next project
})
.subscribe((image: FileRepresentation) => {
data.image = image;
this.getSlide(project, data);
});
})
map:projects.map(project => this.imageService.getProjectImages(project.projectId.ToString()...))will return array of observables.