Making Http GET Data Available Globally

My Ionic 2 App requires me to pull data via Http GET when the app initializes, and I need the resulting data to be available globally across several subsequent pages without having to make the Http get request with each new page load. What’s the best way to handle this situation? Thanks in advance!


You can use an angular service with a variable, setter and getter. In each page, inject the service and use the getter function to get the data.


Thanks, @ashley_shookhye! I’m able to successfully create an angular service that injects into the pages I need. The problem is that my Http request fires each time it’s injected.

Perhaps a better way to ask this is: Let’s say I’m using Ionic’s sidemenu template. If I were to move my Http request to the app.component.ts default MyApp class, how could I access the variable that holds the requested data from other subsequent pages without firing the Http request each time?

use ionic2 local storage and store the data in initialize hook so that it only fired 1st time. then retrieve it from storage.

Thank you very much, @sanjib_dev! This was exactly the solution I was looking for. Now my *ngFor lists populate instantly. Cheers!