【发布时间】:2020-09-12 22:59:12
【问题描述】:
是否可以取消中链的 Observable?假设我们有一些相互依赖的事件链,如果一个链发生故障,则无需继续。
observable_1.pipe(
take(1),
switchMap((result_1) => {
// Do something that requires observable_1 and return something
// If it fails, there is no point to proceed
// If it succeeds, we can continue
}),
switchMap((result_2) => {
// Do something that requires result_2 and return something
// If it fails, there is no point to proceed
// If it succeeds, we can continue
}),
// etc...
);
【问题讨论】:
标签: angular typescript rxjs ngrx