【发布时间】:2019-06-25 18:48:45
【问题描述】:
我在 Google 中搜索过解决方案,但没有找到。
尝试 1:
<input type="text" #txtSearch (keyup)="onKeyUp(txtSearch.value)">
还有search.component.ts
onKeyUp(val){
setTimeout(function(){
console.log(val);
},500);
}
试过 2
我在这里使用类似的 How to achieve a debounce service on input keyup event in angular2 with rxjs 但在 Angular 7 中不起作用。
终于
我预计 keyup 延迟 0.5 秒,然后是 console.log(value);
【问题讨论】:
-
应该可以。如果没有,请在stackblitz.com上提供minimal reproducible example
标签: angular settimeout delay angular7