我怎樣才能得到Angular的web api返回的錯誤信息。如何從角度的web api獲取錯誤消息?
這是我在拉琴
{"Message":"The request is invalid.","ModelState":{"":["Name test1 is already taken."]}}
()''
有什麼值得我誤差函數變爲只顯示「姓名測試1已被使用」已經得到? 這是Angular http post。
$http({
method: 'POST',
url: 'api/Account/Register',
data: { 'UserName': user.username, 'Password': user.password, 'ConfirmPassword': user.confirmpassword, 'Email': user.email },
})
.success(function() {
toastr.success('successfully registered. ');
})
.error(function (error) {
toastr.error('error:' + error);
});
感謝Pascel ..你的答案是偉大的。 – lawphotog