I have this code:
MyService.one($routeParams.wuid).doGET('test').then(function(e){
alert('ok');
}, function errorCallback(response){
alert('error');
});
It calls the managed API, but only a warning ("ok") works, in the case of a 404 response, the callback is not called. I have an 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 do not understand, because the official document says:
How can I handle errors?
Errors can be checked on the second argument then.
Restangular.all ("accounts"). getList (). then (function () {
console.log ("Everything is fine");}, function (response) {console.log ("Error with status code", response.status);});
Where am I mistaken?
source
share