【发布时间】:2022-11-24 05:15:07
【问题描述】:
我很难理解 RxJS 运算符的某些方面。我这里有一些代码(在一个组件中):
extendedOrders$ = this.salesService.getOrders().pipe(
switchMap(orders => {
return forkJoin(orders.map(order => {
return this.salesService.getOrderCustomers(order.id).pipe(
map(customer => ({ ...order, customerName: customer.name })),
);
}));
}),
);
是否有可能扩展它并在 forkJoin 中做不止一个调用?例如,另一个调用另一个 getById 服务并将响应合并到同一个对象中?
【问题讨论】: