【发布时间】:2022-01-24 05:32:15
【问题描述】:
我有一个 ID 数组。例如:[1,2,3,4]。
我想对数组的每个元素进行并行调用并使用forkJoin 获得结果。但是下面的代码对我不起作用。
forkJoin(
Array.from(this.question.attachments).map(attachment => {
return mergeMap((attachment) => ) // i am stuck here.
})
)
.pipe(
takeUntil(this.destroy$),
finalize(() => this.spinnerService.hide())
)
.subscribe((attachmentIds) => {
this.uploadedAttachments = attachmentIds;
this.onFilesAttached.emit(this.uploadedAttachments);
});
谁能帮助我如何实现这一目标?谢谢
【问题讨论】:
标签: angular rxjs angular11 mergemap