Problem. I am required to post make 3 HTTP post requests to 3 different endpoints. I am using concatMap to sequentially HTTP post to an observable. My issue takes place when I need to use a foreach loop to get each value from the formarray.
My code is returning an error.
core.js:5967 ERROR TypeError: You provided 'undefined' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.
at subscribeTo (subscribeTo.js:27)
at innerSubscribe (innerSubscribe.js:69)
at MergeMapSubscriber._innerSub (mergeMap.js:57)
at MergeMapSubscriber._tryNext (mergeMap.js:51)
at MergeMapSubscriber._next (mergeMap.js:34)
at MergeMapSubscriber.next (Subscriber.js:49)
at TapSubscriber._next (tap.js:46)
at TapSubscriber.next (Subscriber.js:49)
at MapSubscriber._next (map.js:35)
What I have tried…
concatMap(() => this.incentiveRecurringEntryForm.controls['entryRowsRecurring'].value.forEach(r => {
this.updateRecurringWithJobID = addToObject(r, 'IncentiveID', this.job_id);
console.log(this.updateRecurringWithJobID)
return this.routeService.postIncentive_Add_Recurring(this.updateRecurringWithJobID).subscribe(
res => {
console.log(res)
}
)
})),
concatMap(() => return undefined);you must return something like a new Observable.forEachis actually returningundefined.