Conditionally choose observable in RxJS

假如想象 提交于 2019-12-05 23:44:48

You could try :

let obs3 = obs1.isEmpty().map(x => x? obs2 : obs1;)

Will check quickly now if that would work.

Yep, according to the doc, it should be fine, as isEmpty emits a boolean which is true if the observable is empty, so you can use that to pick up the observable you want.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!