Http in Ionic 2

Has anyone seen a tutorial or example HTTP get with the latest version of ionicBeta. My Apps depend on external JSON files to update information.

Here you go: http://www.joshmorony.com/using-http-to-fetch-remote-data-from-a-server-in-ionic-2

Be sure to check his blog for other ionic2 tutorials: http://www.joshmorony.com/?s=ionic+2

1 Like

Thanks a lot for the quick reply. i was missing the the

import ‘rxjs/add/operator/map’;

This really helped out a lot.

Hi guys,

Would you mind to tell me why is so important to have the “.map” between the .get and .subscribe in the request? What is the advantage?

Right now, I am doing a simple this.http.get(url).subscribe((data) => this.info = data.json()) and it is working.

Just to let you know that I am new on that.

Thanks

I have found depending on version/ release of AngularJS, map may or may not be required but as of the latest version I am using map works.

But what is the advantage?

kinda of a weak answer but I got it from the docs

https://angular.io/docs/ts/latest/api/http/Http-class.html

and I figured they know more than I do.

Hi @icarus,
RXJS is a combination of Observables, Operators and Schedulers. Map is used to perform operations (if required) on the data obtained from observables. To understand in a best way check https://github.com/Reactive-Extensions/RxJS.

Hope it will help you more