【发布时间】:2020-04-30 07:41:11
【问题描述】:
我有一个对象数组,我想遍历数组并为每个元素调用服务,但是对于每个元素,我只想在当前调用为时调用下一个元素成功完成,除非阻止其余的。
onUpload(items: MyItem[]) {
items.forEach(i => {
myService.doSomething(i).subscribe(response => {
// do something with the success item i
// do the next call for the next item
}, error => {
// handle the error
})
})
}
是否可以在序列模式下调用 Observables 而不是并行?
【问题讨论】:
-
也许这会对你有所帮助:stackoverflow.com/questions/42334469/…
标签: angular rxjs observable