I don't know what is happening with angular, it is not catching errors response, I see here questions about this with no answers.
I have a simple http request, I'm getting 400 response and I want to show a message to the user when its happen, the problem is that the part of the 200 is executed.
I have try in two ways:
this.forgatPassword = function(data) {
return $http.post('http://someaddress/ForgotPassword', data);
}
$scope.forgatPassword = function() {
AuthService.forgatPassword($scope.user).then(function(res) {
$scope.message = true;
}, function(error) {
console.log('rejected');
});
}
$scope.forgatPassword = function() {
AuthService.forgatPassword($scope.user).then(function(res) {
$scope.message = true;
}).catch( function(error) {
console.log('rejected');
});
}