网易云

Ionic实战视频教程(跨平台): https://www.itying.com/goods-1067.html

Flutter实战视频教程(跨平台): https://www.itying.com/goods-1176.html

HTTP

Contents

Cordova / Phonegap plugin for communicating with HTTP servers. Supports iOS and Android.

Advantages over Javascript requests:

  • Background threading - all requests are done in a background thread
  • SSL Pinning
https://github.com/silkimen/cordova-plugin-advanced-http

联系我们?

If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic's experts offer official maintenance, support, and integration help.

Contact Us Today!

Ionic 原生HTTP插件的安装(Installation)

ionic cordova plugin add cordova-plugin-advanced-http npm install @ionic-native/http
Ionic EE comes with fully supported and maintained plugins from the Ionic Team. Learn More or Contact Us
ionic enterprise register --key=YOURPRODUCTKEY npm install @ionic-enterprise/http

Ionic 原生HTTP插件支持的平台(Supported Platforms)

  • Android
  • iOS

Ionic 原生HTTP插件的用法(Usage)

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

constructor(private http: HTTP) {}

...

this.http.get('http://ionic.io', {}, {})
  .then(data => {

    console.log(data.status);
    console.log(data.data); // data received by server
    console.log(data.headers);

  })
  .catch(error => {

    console.log(error.status);
    console.log(error.error); // error message as string
    console.log(error.headers);

  });