I am trying to retrieve a service which is running on another port.I am getting an error as follows
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.
my service.ts file is as follows
getDeviceInfo(){
let headers = new Headers();
headers.append('Access-Control-Allow-Origin', 'http://localhost:3000',);
headers.append('Access-Control-Allow-Headers','Authorization')
let options = new RequestOptions({
method: RequestMethod.Get,
url: DEVICE_URL,
headers: headers
});
return this.http.request(new Request(options))
.map((res: Response) => res.json());
}
thanks in advance