如何在RXJS中迭代管道内的列表

问题描述 投票:0回答:1

我有一个变量,它是一个列表this.formListModel = [studentData1,studentData2,studentData3]现在我必须遍历上面列表中的每个学生数据,并且需要传入一个方法,该方法将通过API将这些数据发送到后端所以这是小代码

 1. this.odataNotificationService.cancelNotification(this.model)
 2.            .pipe(
 3.                tap(() => {
 4.                    someFunctionality..
 5.                    someFunctionality..
 6.                }),
 7.                flatMap(() => this.someFunctionWhichReturnsObservable()),
 8.                flatMap(() =>  this.someSecondFunctionWhichReturnsObservable()),
 9.                flatMap(() => this.formListModel.map(()=>{
                                      return this.thirdFunctionWhichReturnsObservable(form.identifier)
                                   }))

现在我在第9行和第10行有问题在这里,我有一个列表,该列表存储在变量this.formListModel中,在其中需要迭代数据并需要发送下一步功能this.thirdFunctionWhichReturnsObservable(form)

我在flatMap中使用了永远无法工作的地图。因此,我正在寻找一种可以在管道内进行迭代的解决方案

angular rxjs angular8 rxjs6 flatmap
1个回答
1
投票
我会做这样的事情:
© www.soinside.com 2019 - 2024. All rights reserved.