【发布时间】:2017-09-29 07:16:09
【问题描述】:
尝试按顺序一个接一个地 http 发布数组中的项目。知道应该使用 RxJS flatMap 但无法使其工作。基本上我需要这样的东西:
item 是一个名为 items 的数组的元素,想要遍历数组并发送每个 item。
this.http.post(url, item)
.subscribe(
(response) => {
// call the same http.post again to send the next item
},
(error) => {
this.app.error(error.json() as Error); // exit
}
)
感谢您的帮助。
【问题讨论】: