【发布时间】:2022-12-07 08:02:09
【问题描述】:
Obs1$.pipe(
mergeMap((data) => {
if (data.condition) {
const generatedStuff = doSomethingFunction(data1);
return generatedStuff.Obs2$;
}
someCleanupAction();
return of(null); // I want to get rid this because I don't want to call doSomethingElse() when a failure happens
})
).subscribe(() => {
doSomethingElse();
})
以上是我目前基于https://stackoverflow.com/a/74552146/5195033的代码。
就像我上面的评论一样,我只是希望在条件为 true 时调用 doSomethingElse()。
【问题讨论】:
标签: typescript rxjs observable subscribe mergemap