Bower 安装后无法在 Angularjs 应用程序中包含 ngMessages 模块
Can't include ngMessages Module in Angularjs application after bower install
我在尝试在 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 版本似乎也可以。有什么想法吗?
您的 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 项目中安装和导入 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 版本似乎也可以。有什么想法吗?
您的 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"
}
}