Ionic with Magento API call

This problem only is present on Browser, cause on Android and IOS devices works without errors, you must add a proxy config on ionic json config file.

-> ionic.config.json file

“type”: “ionic-angular”,
“proxies”: [
{
“path”: “/magentoAPI”,
“proxyUrl”: “http://magento.docker.local/rest/V1/
}
]
}

and use the path as your url from http
example:
class …
private magentoAPI:string ="/magentoAPI";

customerInfoService() {
let headers = this.headers;
headers.append(‘Authorization’, "Bearer " + this.token);
let options = new RequestOptions({ headers: headers });
return this.http.get(this.magentoAPI + “customers/me”, options)
.map(response => response.json());

}

You can find more info here: Proxy Problems with Ionic

Regards,
Marlon Olaya