Angular headers error 2

0

I have the following code to receive my form data and send it to my service that you create with spring

  

angle code

crearCalidadProducto(calidadproducto: CalidadProducto){

    let json = JSON.stringify(calidadproducto);
    let params = 'json='+json;
    let headers = new Headers({'Content-Type':'application/json'});
    headers.append('Access-Control-Allow-Origin','*');

    return this._http.post(this.url+'crear',params, {headers: headers})
        .map(res => res.json());
}

but at the moment of sending by post it shows me the error in the console

  

Error in the browser console

Failed to load link : Response to preflight request does not pass access control check: No 'Access-Control-Allow- Origin 'header is present on the requested resource. Origin ' link ' is therefore not allowed access. The response had HTTP status code 403.

Thanks for your input

    
asked by Sebastian Samayoa 01.11.2017 в 22:34
source

1 answer

0

I am not an expert in Java, but this problem I had with Node and it is a CORS problem. Surely in the documentation of Spring find something for now I leave this link for you to take a look. By this I mean that the problem is on the server side.

link

I hope it serves you. Greetings.

    
answered by 01.11.2017 в 23:01