I am getting below error: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://safe-pay.co/safepay/public/api/user. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
I have given below is my code. Any body help me to get resolve this issue.
import { Injectable } from "@angular/core";
import { Http, Response ,Headers } from '@angular/http';
import 'rxjs/add/operator/map';
@Injectable()
export class UserService {
userUrl = "http://safe-pay.co/safepay/public/api/user";
constructor(public http: Http) {
}
getCategories() {
let jsonData = {"Data":{
"action": "CATEGORIES",
"lang": "AR"
},
"Request": {
}
}
var headers = new Headers();
headers.append('Content-Type', 'application/json');
return this.http.post(this.userUrl,jsonData,{
headers: headers }).map(res => res.json()).subscribe(data => {
console.log("data: ",data");
},
(err)=> console.log("error: ",err);
);
}