在 Angular 2.0.0-beta.0 中,表单输入的 Observable 中缺少 map() 和 filter()
In Angular 2.0.0-beta.0 map() and filter() are missing from a form input's Observable
在 Angular 2.0.0-alpha.47 中,调用 formInput.valueChanges()
返回的 Observable
具有所有高阶函数,即我可以做这样的事情;
this.search.valueChanges
.debounceTime(150)
.map(x=>return x+1)
.switchMap(text => this.youtube.search(text));
我现在使用的是 2.0.0-beta.0,从 this.search.valueChanges()
返回的 Observable
不再具有所有方法。我只能订阅。我不能再调用 map()、filter() 等
有谁知道这是否是现在表单输入的预期行为?
您是否尝试导入这个:
import 'rxjs/add/operator/map';
查看此问题了解更多详情https://github.com/angular/angular/issues/5632
希望对你有帮助,
蒂埃里
像这样导入 Rxjs:
Import * as Rx from "rxjs/Rx";
运营商将可用。
当你使用 Observable 时 class .. 用 Rx 作为前缀。 ( Rx.Observable )
在 Angular 2.0.0-alpha.47 中,调用 formInput.valueChanges()
返回的 Observable
具有所有高阶函数,即我可以做这样的事情;
this.search.valueChanges
.debounceTime(150)
.map(x=>return x+1)
.switchMap(text => this.youtube.search(text));
我现在使用的是 2.0.0-beta.0,从 this.search.valueChanges()
返回的 Observable
不再具有所有方法。我只能订阅。我不能再调用 map()、filter() 等
有谁知道这是否是现在表单输入的预期行为?
您是否尝试导入这个:
import 'rxjs/add/operator/map';
查看此问题了解更多详情https://github.com/angular/angular/issues/5632
希望对你有帮助, 蒂埃里
像这样导入 Rxjs:
Import * as Rx from "rxjs/Rx";
运营商将可用。
当你使用 Observable 时 class .. 用 Rx 作为前缀。 ( Rx.Observable )