RxJS为Angular2提供了哪些功能? [英] What functionalities that RxJS provide for Angular2?

查看:77
本文介绍了RxJS为Angular2提供了哪些功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一些引用. Angular2中RxJS的用途是什么?

There is some references of RxJS in the Angular2 project. What is RxJS being used for in Angular2?

推荐答案

angular2使用RxJS的列表

A list of what angular2 uses RxJS for

  • Http (for example its get method returns an Observable)
  • EventEmitter (like you said, extends from Subject)
  • AsyncPipe which supports Promise, Observable or EventEmitter.
  • QueryList's changes method returns an EventEmitter. Update
  • NG_ASYNC_VALIDATORS which implements Validator and overrides the method validate to return either a Promise or an Observable. Update

有关NG_ASYNC_VALIDATORS的说明

NG_ASYNC_VALIDATORS不直接使用Observable,它不订阅它们,而是将它们转换为Promises,在任何情况下,NG_ASYNC_VALIDATORS仍接受Observables.查看#104 validators.ts中的a>.

NG_ASYNC_VALIDATORS doesn't use Observable directly, it doesn't subscribe to them but converts them to Promises, in any case, NG_ASYNC_VALIDATORS still accepts Observables. Look at line #104 in validators.ts.

感谢@przemcio的观察.

Thanks to @przemcio for the observation.

尚未实施/正在对话

  • ObserveChild which would return an EventEmitter.
  • ObserveChildren Update

注意

他们正在使用裸操作符来处理RxJS包,请参见问题#5288 .这个想法是用最少的所需运算符分发angular2,并让用户提供其余的运算符.

They are working on bundle RxJS with the bare operators, see issue #5288. The idea is to distribute angular2 with the minimal required operators and make the user to provide the rest of them.

注释更新

就像我被告知此处

Like I was told here and here (I had a problem with importing Subject) they're working on removing completely Subject, so from core we would be able to import only Observable, everything else should be provided by the developer.

PS

我想不出其他任何办法,如果我还记得其他事情,我会更新答案.

I can't think of any other, if I remember of something else I'll update the answer.

这篇关于RxJS为Angular2提供了哪些功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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