这是我的HTTP get请求
$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"和"状态"从这个回应?
答案 0 :(得分:1)
更改条件if (response.status == 200)
& else if (response.status == 304)