angularjs - 安装 bower 后无法在 Angularjs 应用程序中包含 ngMessages 模块

标签 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 

正如您从下面看到的,我相信我已经正确导入了 Angular 消息模块(在 index.html 中)。

我还包括了文件路径和我的 app.js 的图像,它会导入 ngMessage。 Bower 版本似乎也可以。有什么想法吗?

enter image description here

enter image description here enter image description here

enter image description here

最佳答案

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

关于angularjs - 安装 bower 后无法在 Angularjs 应用程序中包含 ngMessages 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43297914/

相关文章:

javascript - 链接 Protractor 中的所有语句

javascript - 使用 Javascript AngularJS 单击重置值

ember.js - Ember 构建失败

jquery - Bower、Grunt、Bootstrap、Jquery 和 JavaScript 错误

angularjs - Angular Bootstrap 后加载模块

javascript - 使用 typescript 缩小时,angularjs 未定义主模块

javascript - angularjs可选参数的ui-router

javascript - 如何从返回 JSON 的 REST Web 服务加载 ng 表中的数据

bower - 覆盖 bower.json 文件中的依赖项

javascript - 如何将共享服务与不使用共享服务的 Controller 一起使用?