How to use / make Http GET request Ionic2


I’m implementing an app that will need to make Http requests (GET and POST) and I’m trying to implement a simple Http GET Request, but can’t get it to work.

I have a provider that will handle the http request, that should be imported in a page.


import {Injectable, Inject} from 'angular2/core';
import {Http} from 'angular2/http';
import 'rxjs/add/operator/map';

export class MyHttpProvider {
  static get parameters(){
    return [[Http]];

  constructor(http) {
    this.http = http; = null;

  load() {
    if ( {
      // already loaded data
      return Promise.resolve(;

    // don't have the data yet
    console.log('making request');
    return new Promise(resolve => {
      this.http.get('BitTorrent.json').subscribe(res => { = this.processData(res.json());
      err => {

And my view class:

import {Page, Alert, NavController} from 'ionic-angular';
import {MyHttpProvider} from '../../providers/google-provider/google-provider';

  templateUrl: 'build/pages/getting-started/getting-started.html',
  providers: [MyHttpProvider]

export class GettingStartedPage {
	static get parameters(){
		return [[NavController],[MyHttpProvider]];
	constructor(nav, myHttpProvider) {
		this.nav = nav;
		this.load = myHttpProvider.load;

As soon as I click on a button that will call the load function:

<button block wout (click)="load()">make get reqt</button>

I only get “making request” as output to console.
On Chrome inspect console, no request is made, and I don’t get any error at all.

What am I missing?
I’me new to both Ionic and AngularJs, I’ve read documentation and examples but no success yet.

Thanks in advance

1 Like