【发布时间】:2021-07-05 20:49:23
【问题描述】:
我想检查状态码是否=400,以便获取通知
我试过了-
signUp() {
let body =
{
login: this.username,
nom: this.nom,
prenom: this.prenom,
adress: this.adress,
email: this.email,
password: this.password,
date_naissance: this.datenaissance,
num_tel: this.numTel,
}
this.signappService.newsignup(body).subscribe(
(res: any) => {
console.log(res)
this.sucess = true;
this.failed = false;
},
(err) => {
console.warn(err)
if (err.status == 400) {
this.failed = true;
this.sucess = false;
}
});
}
【问题讨论】:
-
您当前的代码有什么问题?是不工作,还是显示任何错误?
-
即使在我的控制台中也没有显示任何错误我有错误状态 400
-
您确定 this.signappService.newsignup(body) 调用的后端实际上正在产生 400 状态响应。您是否尝试过 console.log'ing 错误是什么?
-
是的,我确信我在试验中故意犯了错误,所以通知出现
-
是的,我确信我在试验中故意犯了错误,所以通知出现
标签: angular