如何在 getFooBar 返回 observable 的 map 函数中等待结果?
防爆代码:
this.fooBarResponse.fooBars.map(async (x) => {
x.fooBar = await this.fooBarService
.getFooBar(x.fooBarId.toString())
.toPromise();
return x;
});
foobar.service.ts
getFooBar(id: string): Observable<FooBar> {
return this.fooBarsCollection.doc<FooBar>(id).valueChanges();
}
慕勒3428872
温温酱
相关分类