在bower安装之后,不能在Angularjs应用程序中包含ngMessages模块

时间:2017-04-08 16:59:35

标签: angularjs bower angularjs-module

我在尝试在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。凉亭版本似乎还可以。有什么想法吗?

enter image description here

enter image description here enter image description here

enter image description here

1 个答案:

答案 0 :(得分:2)

您的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"
  }
}