在Angular 2.0.0-beta.0中,map输入的Observable中缺少map()和filter()

scr*_*key 6 angular2-forms angular

在Angular 2.0.0-alpha.47中,Observable从调用返回的 formInput.valueChanges()函数具有所有高阶函数,即我可以做这样的事情;

this.search.valueChanges
 .debounceTime(150)
 .map(x=>return x+1)
 .switchMap(text => this.youtube.search(text));
Run Code Online (Sandbox Code Playgroud)

我现在使用2.0.0-beta.0并且Observable返回的this.search.valueChanges()不再具有所有方法.我只能订阅.我不能再调用map(),filter()等.

有谁知道这是否是表单输入的预期行为?

Mou*_*abi 6

像这样导入Rxjs:

Import * as Rx from "rxjs/Rx";
Run Code Online (Sandbox Code Playgroud)

运营商将可用.

当您使用Observable类时,请使用Rx作为前缀.(Rx.Observable)

  • 我有同样的问题..我花了4个小时来解决问题..从Rxjs 4到5的过渡并不容易.. https://github.com/ReactiveX/RxJS/blob/master/MIGRATION.md (2认同)