I am working on an Ionic 3 project, and have been trying to use Ionic Native's HTTP (https://ionicframework.com/docs/native/http/). I started out by creating a separate provider that used HTTP, but any page that imported the provider wouldn't load / be navigated to. I didn't understand this, so I tried to use it directly on the page itself, instead of creating a provider. After troubleshooting, I realized that the issue occurred whenever HTTP was called in the constructor. There is no error being thrown when I run it with console logs.
Here is my code:
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { LocationTracking } from '../../providers/location-tracking';
import firebase from'firebase';
import { HTTP } from '@ionic-native/http';
@IonicPage()
@Component({
selector: 'page-ad',
templateUrl: 'ad.html',
})
export class AdPage {
postId = 0;
imgURL: any;
testToBeSent: any;
childRef: any;
zipCode: any;
constructor(public navCtrl: NavController, public navParams: NavParams,public LocationTracking: LocationTracking, private http: HTTP) {}
My goal is to be able to navigate to any page that uses Ionic 3's HTTP plugin, or any page that uses a provider that uses Ionic 3's HTTP plugin.
import { Http } from '@angular/http';instead of native http. - Quad