How can i get error message returned by web api in Angular.
This is what I have got in fiddler
{"Message":"The request is invalid.","ModelState":{"":["Name test1 is already taken."]}}
()''
what do i change in error function to show just 'Name test1 is already taken'? This is 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);
});