在角2.0.0 beta.0 map()和过滤器()是从表单输入的观测失踪 [英] In Angular 2.0.0-beta.0 map() and filter() are missing from a form input's Observable

查看:106
本文介绍了在角2.0.0 beta.0 map()和过滤器()是从表单输入的观测失踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在角2.0.0 alpha.47的观测从调用 formInput.valueChanges返回()把所有更高阶的职能,即我可以做这样的事情;

In Angular 2.0.0-alpha.47 the Observable returned from calling formInput.valueChanges() had all the higher order functions i.e I could do something like this;

this.search.valueChanges
 .debounceTime(150)
 .map(x=>return x+1)
 .switchMap(text => this.youtube.search(text));

现在我使用的是2.0.0-beta.0和观测 this.search.valueChanges()不再拥有的所有方法。我只能订阅。我不能再调用地图(),滤波器()等。

I'm now using 2.0.0-beta.0 and the Observable returned from this.search.valueChanges() no longer has all the methods. I can only subscribe. I can no longer call map(), filter() etc.

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

Does anyone know if this is the expected behaviour for form inputs now?

推荐答案

进口Rxjs是这样的:

import Rxjs like this :

Import * as Rx from "rxjs/Rx";

该运营商将可用。

The operators will be available.

当您使用可观察到的类。与接收preFIX它。 (Rx.Observable)

When you use Observable class .. prefix it with Rx. ( Rx.Observable )

这篇关于在角2.0.0 beta.0 map()和过滤器()是从表单输入的观测失踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆