I'm reading a book called, Pro Angular JS.
However, I have a question about how to catch a status of error.
What I coded is :
$http.get(dataUrl)
.success(function (data){
$scope.data.products = data;
})
.error(function (error){
$scope.data.error=error;
console.log($scope.data.error.status); // Undefined!
// (This is the spot that I don't get it.)
});
If I code console.log($scope.data.error.status); , why does the argument of console.log is undefined?
In the book, there are sentence, The object passed to the error function defines status and message properties.
So I did $scope.data.error.status
Why is it wrong?