【发布时间】:2019-10-03 13:52:20
【问题描述】:
我在订阅中将isUpdate 标志设置为 true,我必须在延迟一段时间后将其设置回 false,以便显示快速弹出窗口
我尝试过使用.pipe(delay(2000)).subscribe 但是整个回调被延迟了
this.sp.myservice(data).subscribe(
data => {
this.isUpdate = true;
//something like this but not setTimeout
setTimeout(() =>
{
this.isUpdate = false
}, 2000)
}
);
预期结果:isUpdated 在一段时间内应该为假
【问题讨论】:
-
为什么不 setTimeout()?
标签: javascript angular rxjs rxjs-observables