在Angular更新指南之后我将Angular 5项目更新为Angular 6后 我得到了.
Property 'debounceTime' does not exist on type 'Observable<any>'
Run Code Online (Sandbox Code Playgroud)
运行后ng update我的所有组件丢失了debounceTime import.但我手动把它放回去,但这并没有解决问题.
example.component.ts
import { debounceTime } from 'rxjs/operators';
//Added after removed by ng update
this.searchField.valueChanges
.debounceTime(800)
.distinctUntilChanged()
.subscribe(term => {
this.searchText = term;
this.getAllDoctors();
},
Run Code Online (Sandbox Code Playgroud)
我真的想了解这里发生的事情.
您需要使用管道操作员.
this.searchField.valueChanges
.pipe(debounceTime(800),
distinctUntilChanged()
)
.subscribe(term => {
this.searchText = term;
this.getAllDoctors();
}),
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1659 次 |
| 最近记录: |