What functionalities that RxJS provide for Angular2?

…衆ロ難τιáo~ 提交于 2019-12-06 00:49:28

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

Note about NG_ASYNC_VALIDATORS

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.

Thanks to @przemcio for the observation.

Not yet implemented / In conversation

Note

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.

Note update

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!