Ionic Native HTTP 客户端 (@ionic-native/http) 在导入时不工作

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

当我按照文档中的描述导入 HTTP 客户端时,出现以下错误:

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

这是我的代码:

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() {
  }
}

我已经按照此处所述安装了正确的离子原生 npm 包 https://ionicframework.com/docs/native/http/

您正在查看 v3 文档。
在此处查看 Ionic 4 文档:

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

Ionic 4 使用稍微不同的导入路径:

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