Where are my Observable operators? :-)

Where are my Observable operators? :-)

Just a note to myself: Since AngularJS 2 Beta 0, it will not expose Observable anymore. Before Beta 0 (or some alpha’ish 48) you could do:

import {Observable} from 'angular2/angular2';

Starting with Beta 0, you need to import it directly from RxJS:

import {Observable} from 'rxjs/Rx';

But watch out! You only get a very small subset of an Observable:

As you can see, at lot of operators are missing. But this is not a fault, this is by design. They (the Angular 2 devs) will not ship all available operators. This would result in additional 300 kb. So, to get an Observable with more operators, you could either import the ones you need, or import all. Important: They need to be imported just once, so your boot.ts or app.ts would be a good place.

To import only needed operators:

import 'rxjs/add/operator/map'; import 'rxjs/add/operator/filter';

To import all operators:

import 'rxjs/Rx';