I am currently working with an Observable to convert a promise into a subscription. This leads to a collection that requires iteration in order to call an HTTP Service on each element. I am using forkJoin to wait for all the calls to finish before proceeding, but unfortunately, my subscription is not triggering. Is there something crucial that I may be overlooking?
Observable.fromPromise(this.users.getElements()).subscribe(results => {
Observable.forkJoin(
results.map(
aUser => this.HttpService.submitUser(aUser).subscribe(
results => {
this.progress += 1;
},
err => {
this.progress += 1;
this.handleError(<any>err);
})
).subscribe(
//the code never reaches these calls after completing all service calls
data => {
debugger;
console.log(data);
this.reset();
},
err => {
debugger;
console.log(err);
this.reset();
}
));
});