RXJS有条件地致电可观察到
const observable$ = iif(() => this.shippingTabModified,
//Shipping Tab Modified True
of(this.updateShippingInfo())
.pipe(),
//IF Shipping Tab Not Modified
of(this.shippingInfoService.getShipmentInfoByCardIdObservable(this.data.CardId))
.pipe()
)
observable$.subscribe();
从上面的代码中,我想实现以下方案
if(foo === true)
{
updatemethod()
}
// if foo is true and update method is executed we need to wait until update method is finished then go to second method
// If foo is false we can call second method without waiting
secondmethod();
,但是从我上面写的RXJS代码中,它总是转到更新方法,它不是考虑this.shippingtabmodified
的值。
const observable$ = iif(() => this.shippingTabModified,
//Shipping Tab Modified True
of(this.updateShippingInfo())
.pipe(),
//IF Shipping Tab Not Modified
of(this.shippingInfoService.getShipmentInfoByCardIdObservable(this.data.CardId))
.pipe()
)
observable$.subscribe();
From above code i want to achieve following scenario
if(foo === true)
{
updatemethod()
}
// if foo is true and update method is executed we need to wait until update method is finished then go to second method
// If foo is false we can call second method without waiting
secondmethod();
But from rxjs code which i wrote above, it always go to update method it is not considering the value of this.shippingTabModified
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以利用
concat
功能,然后做类似的事情
You can leverage on the
concat
function and do something like thisCheers
为什么不只是使用
编辑
在条件下致电:
Why not just use
EDIT
Calling on condition :