我只需要从多个最新订阅。当我的FormControl值发生变化时,我只需要在用户完成输入后获得最新值。这是我的代码 -let control = this.register.controls['email'];control.valueChanges.debounceTime(300).pipe(take(1)).subscribe(newValue => { console.log(newValue);})但它返回多个Subscriptions. 我怎样才能得到最新的?
2 回答
![?](http://img1.sycdn.imooc.com/54584eff000195a302200220-100-100.jpg)
慕虎7371278
TA贡献1802条经验 获得超4个赞
您可以使用withlatestfrom
let control = this.register.controls['email'];
control.valueChanges.debounceTime(300).pipe(withLastestForm(control.valueChanges)).subscribe(newValue => {
console.log(newValue);
})
将此代码相应地更改为您的
添加回答
举报
0/150
提交
取消