I have an interceptor that does
if (response.status !== 200){
return $q.reject(response.statusText);
}
Then in my $http I do
$http({
method: 'POST',
url: '/something/parameters',
data: JSON.stringify(data)
})
.success(function(data, status, headers, config) {
//
})
.error(handleError);
function handleError(data) {
console.log(data) //undefined?!
}
I got undefined.
But when I do .error(function(data){ console.log(data) }) I got the response statusText, why? I have to split the function out because I have a service need to be triggered.
.error(handleError(data));?response.data