这是我的HTTP获取请求
$http({
method: 'GET',
url: baseURL + '/couponManager/createCoupon?token=' + token + query1 + query2 + query3 + query4 + query5,
}).then(function successCallback(response) {
if (response.status = 200)
{
$scope.showSuccessAlert = true;
$scope.successTextAlert = "Coupon successfully created!";
}
else if (response.status = 304)
{
$scope.errorAlert = true;
$scope.errorTextAlert = "Something Went Wrong, Please try again!";
}
}, function errorCallback(response) {
$scope.errorAlert = true;
$scope.errorTextAlert = "Can't reach server, please try later!";
});
这是我得到的回应
{"success":"no","data":{},"error_code":"DW3","error_description":"Server Error"}
但是我收到的状态仍然是200,如何从该响应中检索“error_description”和“status”?
最佳答案
更改条件if (response.status == 200)
和else if (response.status == 304)
关于angularjs - AngularJs http得到回应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43464349/