Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70429

Can not post using native http method to the Nodejs API

$
0
0

@dimithrab wrote:

Uncaught Error: advanced-http: “data” option is configured to support only following data types: Object
anyone know how to fix this?
below i have mentioned my code. thanks.
don’t care about the API

async uploadImageData(formData: FormData) {

const loading = await this.loadingController.create({

  message: 'Uploading image...',

});

await loading.present();

let nativeCall = this.nativehttp.post("http://localhost/api", formData, {});

from(nativeCall).pipe(

  finalize(() => {

    loading.dismiss();

  })

).subscribe(res => {

  if (res['success']) {

    this.presentToast('File upload complete.');

  } else {

    this.presentToast('File upload failed.');

  }

});

}

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70429

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>