AngularJS$http请求选项和POST

AngularJS$http请求选项和POST,angularjs,javascript-framework,Angularjs,Javascript Framework,我试图用$http AngularJS获取POST error响应,但是当我在catch中查看响应变量时,我得到了飞行前选项响应。如何获得POST响应,而不是选项 我的选项返回200 OK,我的帖子返回402。 但是我的reason.data是空的 提前谢谢 $http.post(url, data, {headers:{}}) .then( function ( response ) {}) .catch( function ( reason ) { console.log(reaso

我试图用$http AngularJS获取POST error响应,但是当我在catch中查看响应变量时,我得到了飞行前选项响应。如何获得POST响应,而不是选项

我的选项返回200 OK,我的帖子返回402。 但是我的reason.data是空的

提前谢谢

$http.post(url, data, {headers:{}})
.then( function ( response ) {})
.catch( function ( reason ) {
    console.log(reason);
});
---编辑---


实际上,POST响应似乎正常,但我的原因返回状态:-1和数据:null

如果
选项
请求失败并点击
捕获
块,则不会执行
POST
。对于飞行前选项请求,浏览器不会将选项响应传递给JavaScript。如果选项请求失败,浏览器将阻止POST请求。AngularJS$http服务返回的状态为
-1
。所有响应都被JavaScript阻止。