Search code examples
typescriptionic-frameworkionic-nativeionic4

Ionic Native HTTP client (@ionic-native/http) not working when importing


When I import the HTTP Client as described by the Docs I get the following Error:

Uncaught (in promise): Error: Can't resolve all parameters for AmtsPage: (?)

Heres my Code:

import {Component, OnInit} from '@angular/core';
import {HTTP} from '@ionic-native/http';

@Component({
  selector: 'app-amts',
  templateUrl: './amts.page.html',
  styleUrls: ['./amts.page.scss'],
})
export class AmtsPage implements OnInit {


  constructor(private http: HTTP) {}

  ngOnInit() {
  }
}

I already installed the right ionic-native npm packages as described here https://ionicframework.com/docs/native/http/


Solution

  • You are looking in the v3 documentation.
    Have a look at the Ionic 4 docs here:

    https://beta.ionicframework.com/docs/native/http

    Ionic 4 uses a slightly different import path:

    import { HTTP } from '@ionic-native/http/ngx';