我有這樣的代碼
var body="ok";
var suc=0; var failed=0;
$http({
url: API.toUrl('api/xxxx/xxxx'),
method: 'POST',
data: body
}).then(function(response) {
if(response.status==200){
suc=suc+1;
}
if(response.status==400){
failed=failed+1;
}
});
我在這個問題是我無法獲得400個狀態碼,我只得到200而不是400 。如何在我的response
參數中獲得400個狀態碼。
我在Angular工作,想要獲得400的任何想法?
感謝
我想,如果響應狀態是400和一個變量,但我不能與response.status處理 – ZizouJd
嘿@Jhonny阿豐索,你有沒有看到我的解決方案? –