我在尝试在 angularjs项目中安装和导入angular-messages模块时遇到了很多麻烦.这是错误消息
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中).
我还包括了文件路径和我的app.js的图像,它们导入了ngMessage.凉亭版本似乎还可以.有什么想法吗?
最佳答案 您的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"
}
}