I'm trying to get the POST error response in $http AngularJS, but when I watch the response variable in catch, I get the preflight OPTION response. How can I get the POST response, instead of OPTION?
My OPTION returns 200 OK and my POST returns 402. But my reason.data is null
Thanks in advance
$http.post(url, data, {headers:{}})
.then( function ( response ) {})
.catch( function ( reason ) {
console.log(reason);
});
---EDIT---
Actually the POST response seems OK, but my reason returns status: -1 and data: null
OPTIONSrequest is failing and hitting thecatchblock then thePOSTwill not be performed.-1. All responses are blocked from JavaScript.