2017-04-08 61 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" 
    } 
} 
相关问题