debounceTime在angular中的使用
2019-04-16 本文已影响0人
有田春雪
debounceTime在angular中的使用
- 在使用
angular
的时候,很多情况需要使用debounceTime
- 网上大多数的资料都是过时的,
rxjs
已经更新了,管道写法不一样了 - 新的写法
import { debounceTime } from 'rxjs/operators'
this.searchInput.valueChange
.pipe(debounceTime(300)) // 使用管道
.subscribe(
// 进行相应的操作
)