【发布时间】:2019-01-25 19:08:36
【问题描述】:
在Angular update guide 之后将我的 Angular 5 项目更新为 Angular 6 后,我得到了。
Property 'debounceTime' does not exist on type 'Observable<any>'
在运行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();
},
我真的很想了解这里发生了什么。
【问题讨论】:
-
angular.io/guide/rx-library#operators。您错过了“使用 rxjs-tslint 自动更新规则删除已弃用的 RxJS 6 功能”步骤。如果您正在执行此步骤,并且不使用仍使用旧 RxJS 语法的旧库,则不需要 rxjs-compat。
-
然后阅读我链接到的文档,并描述应用运算符的语法。