2017-04-08 48 views
3

我在嘗試在angularjs項目中安裝和導入角度消息模塊時遇到了很多麻煩。以下是錯誤消息在bower安裝後不能在ngularjs應用程序中包含ngMessages模塊

Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to: 
Error: [$injector:modulerr] Failed to instantiate module ngMessages due to: 
Error: [$injector:nomod] Module 'ngMessages' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. 
http://errors.angularjs.org/1.6.4/$injector/nomod?p0=ngMessages 
    at http://localhost:8000/bower_components/angular/angular.js:66:12 
    at http://localhost:8000/bower_components/angular/angular.js:2262:17 
    at ensure (http://localhost:8000/bower_components/angular/angular.js:2183:38) 
    at module 

正如你可以從下面看到的,我相信我已經正確導入角的消息模塊(index.html中)。

我還包括了導入ngMessage的文件路徑和我的app.js的圖像。涼亭版本似乎也可以。有什麼想法嗎?

enter image description here

enter image description hereenter image description here

enter image description here

+1

將您的代碼發佈爲文本,而不是圖像。並對所有角度依賴使用相同的版本號。 –

回答

1

你的ng-messages版本與AngularJS的版本兼容。在您的依賴配置中嘗試嚴格版本:

{ 
    "name": "angular-seed", 
    "version": "0.0.0", 
    "private": true, 
    "dependencies": { 
    "angular": "1.6.0", 
    "angular-route": "1.6.0", 
    "angular-loader": "1.6.0", 
    "angular-mocks": "1.6.0", 
    "angular-messages": "1.6.0" 
    } 
} 
相關問題