I have this code :
MyService.one($routeParams.wuid).doGET('test').then(function(e){
alert('ok');
}, function errorCallback(response){
alert('error');
});
It calls an API i managed, but only the alert('ok') works, in the case of a 404 response, the callback isn't called i've a angularjs error in my console.
Error: c is undefined this.$get</e/A/v@http://localhost:8888/client/app/js/libs/restangular.min.js:8 Ad/e/k.promise.then/C@http://localhost:8888/client/app/js/libs/angular.min.js:92 Ad/g/<.then/<@http://localhost:8888/client/app/js/libs/angular.min.js:94 Bd/this.$get</h.prototype.$eval@http://localhost:8888/client/app/js/libs/angular.min.js:102 Bd/this.$get</h.prototype.$digest@http://localhost:8888/client/app/js/libs/angular.min.js:100 Bd/this.$get</h.prototype.$apply@http://localhost:8888/client/app/js/libs/angular.min.js:103 f@http://localhost:8888/client/app/js/libs/angular.min.js:67 E@http://localhost:8888/client/app/js/libs/angular.min.js:71 pd/</v.onreadystatechange@http://localhost:8888/client/app/js/libs/angular.min.js:72
I don't understand because the official doc says :
How can I handle errors?
Errors can be checked on the second argument of the then.
Restangular.all("accounts").getList().then(function() {
console.log("All ok"); }, function(response) { console.log("Error with status code", response.status); });
Where am i wrong ?