I have a problem with HTTP in Angular.
I just want to GET
a JSON
list and show it in the view.
im
Just some background... The newly minted Server Communication dev guide (finally) discusses/mentions/explains this:
The RxJS library is quite large. Size matters when we build a production application and deploy it to mobile devices. We should include only those features that we actually need.
Accordingly, Angular exposes a stripped down version of
Observable
in therxjs/Observable
module, a version that lacks almost all operators including the ones we'd like to use here such as themap
method.It's up to us to add the operators we need. We could add each operator, one-by-one, until we had a custom Observable implementation tuned precisely to our requirements.
So as @Thierry already answered, we can just pull in the operators we need:
import 'rxjs/add/operator/map';
import 'rxjs/operator/delay';
import 'rxjs/operator/mergeMap';
import 'rxjs/operator/switchMap';
Or, if we're lazy we can pull in the full set of operators. WARNING: this will add all 50+ operators to your app bundle, and will effect load times
import 'rxjs/Rx';