3
我有這樣的代碼:與angularjs和restangular發現錯誤
MyService.one($routeParams.wuid).doGET('test').then(function(e){
alert('ok');
}, function errorCallback(response){
alert('error');
});
它調用的API我管理,但只有警報(「OK」)的作品,404迴應的情況下,回調ISN沒有叫我在我的控制檯中有一個angularjs錯誤。
Error: c is undefined this.$get</e/A/[email protected]://localhost:8888/client/app/js/libs/restangular.min.js:8 Ad/e/k.promise.then/[email protected]://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</[email protected]://localhost:8888/client/app/js/libs/angular.min.js:102 Bd/this.$get</[email protected]://localhost:8888/client/app/js/libs/angular.min.js:100 Bd/this.$get</[email protected]://localhost:8888/client/app/js/libs/angular.min.js:103 [email protected]://localhost:8888/client/app/js/libs/angular.min.js:67 [email protected]://localhost:8888/client/app/js/libs/angular.min.js:71 pd/</[email protected]://localhost:8888/client/app/js/libs/angular.min.js:72
我不理解,因爲the official doc說:
我如何處理錯誤?
錯誤可以檢查當時的第二個參數。
Restangular.all( 「帳戶」)的GetList(),然後(函數(){
的console.log( 「一切正常」);}。。,功能(響應){的console.log(「錯誤 與狀態碼「,response.status);});
我在哪裏錯了?
完美工作在我的代碼。創建一個顯示錯誤的蹦牀或小提琴,我相信有人會協助。 – Beyers
感謝您的回覆。我發佈了一段錯誤的代碼,我糾正了。它是一個doGet()而不是一個get(),沒有別的改變 – billyJoe