I am trying to fetch data using WebApi which runs on localhost:58682/home/index1 in Ionic2 app which runs on localhost:8100.
I am getting the following error message.
XMLHttpRequest cannot load http://localhost:58682/home/index1. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access.
My service.ts file
@Injectable()
export class ResponseService{
private responseUrl='http://localhost:58682/home/index1';
getresponseDetails()
{
return this.http.get(this.responseUrl).map(res=>res.json());
}
}
ionic.config.json
{
"name": "App",
"app_id": "90594fdf",
"type": "ionic-angular",
"proxies":[
{
"path":"/home",
"proxyUrl":"http://localhost:58682/home"
}
]
}
I went through some CORS blogs but couldn't fix it. What exactly is going wrong?