Ionic 1 AngularJS HTTP post vs. Ionic 3 Angular HTTP post


I was worked much in the combination of Ionic 1 AngularJS, but after entering into the trend Ionic 3 Angular faced some issues in simple HTTP post request itself.

Let me explain the scenario please find below.


import { HttpModule} from '@angular/http';
    imports: [


import {Http, Headers, RequestOptions} from '@angular/http';
    let link = '';
    var headers = new Headers();
    headers.append("Accept", 'application/json');
    headers.append('Content-Type', 'application/x-www-form-urlencoded');
    headers.append('Access-Control-Allow-Origin', 'http://localhost');
    headers.append('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
    headers.append('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
    headers.append('Access-Control-Allow-Credentials', 'true');
    let options = new RequestOptions({headers: headers});
    let postParams = JSON.stringify({"password":this.passCode, "userName":this.userName});, postParams, options)
    .subscribe(data => {
    }, error => {

While running out in the browser using ionic serve getting below response.

Failed to load No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:8105’ is therefore not allowed access. The response had HTTP status code 400.

As per my understanding if it’s CORS based issues after installed the Chrome CORS plugin as well getting same issues.

Even I tried the direct running for the Android phone using `ionic cordova run android that’s too getting error block.