I am working on Angular $resource and json-server.. when I turn my server off, I get -1 instead of 404
console.log($scope.message + ', response.status: ' + response.status + ', response.statusText: ' + response.statusText );
and my console say: (Error: -1 , response.status: -1, response.statusText: )
any idea? thank you.
Well, when you turn your server off, you can not get 404, because 404 is a response status returned from the server itself. It means that the requested resource (whatever that may be) does not exist on the server. So when the server is not running, it can not obviously return 404.
My guess is that -1 may be Angular's default error status. Like, you know, every status different that 0 is considered error.