I am working on an Angular project. I have a post request to an api but when I run this I get the following access error.
Access to XMLHttpRequest at 'http://150.140.143.213:8085/' from origin 'http://localhost:4200' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
My service is :
addnik(park: any): Observable<any>{
const httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': 'http://localhost:4200',
}),
};
return this.httpclient.post<any>("http://150.140.143.213:8085/",park,
httpOptions, );
}