在我的應用程序,我需要與服務器的REST API連接,所以我已經決定使用這一個:https://github.com/mgonto/restangular但是當我嘗試將其加載到我的模塊:AngularJS加載REST API服務
var app = angular.module('onboarding',['ngRoute','ngSanitize','ngStorage','restangular']);
我得到這個錯誤:
Failed to instantiate module restangular due to:
Error: [$injector:nomod]
http://errors.angularjs.org/1.6.2/$injector/nomod?p0=rest...
at http://localhost:3000/scripts/angular.min.js:6:425
at http://localhost:3000/scripts/angular.min.js:25:399
at b (http://localhost:3000/scripts/angular.min.js:24:439)
at http://localhost:3000/scripts/angular.min.js:25:173
at http://localhost:3000/scripts/angular.min.js:41:117
at q (http://localhost:3000/scripts/angular.min.js:7:351)
at g (http://localhost:3000/scripts/angular.min.js:40:476)
at http://localhost:3000/scripts/angular.min.js:41:134
at q (http://localhost:3000/scripts/angular.min.js:7:351)
at g (http://localhost:3000/scripts/angular.min.js:40:476
在GitHub上的文件上寫着,只有1.0.X和1.5.X版本之間的支持。因爲我使用1.6.2版本可能是問題所在。但是當我將版本更改爲1.5.9時,我得到的錯誤完全相同。
與我的代碼或這個庫的錯誤?有沒有人有角度版本巧合類似的錯誤?
您能否提供一些代碼片段?並且請確保您已經添加了所需的js文件以獲得重新安裝。另外,請將其作爲主模塊中的依賴項包含在內。 –
當然!我編輯了我的代碼。 – andrzej541
restangular應該在1.6.2中正常工作;至於你得到的錯誤,通常發生在你的腳本沒有包含在HTML中,或者它們的順序錯誤時。你可以使用'angular.js'而不是'angular.min.js'來獲得更具描述性的錯誤信息。 – Claies