问题描述
这是非常令人沮丧,即时通讯使用mean.js自耕农生成的应用程序,并不能得到似乎得到角料和运行。我看了有关问题的另一个问题计算器Angularjs与材料设计无法实例化模块ngMaterial 。所以,我更新了我的bower.json文件,并跑了亭子更新
和亭子安装
。它仍然不工作。在凉亭更新,凉亭给了我这个消息无法找到一个合适的版本角,请选择一个:
,但我总是选择了一个角版本1.3.0或更高版本。结果
我的继承人bower.json的副本:结果
This is very frustrating, Im using a mean.js yeoman generated application and can't get to seem to get angular-material up and running. I read another stackoverflow question about the issue Angularjs with material design Failed to instantiate module ngMaterial. So I updated my bower.json file and ran a bower update
and bower install
. It still doesnt work. During the bower update, bower gave me this message Unable to find a suitable version for angular, please choose one:
, but I always chose an Angular version 1.3.0 or greater.
Heres a copy of my bower.json:
{
"name": "colign",
"version": "0.0.1",
"description": "Full-Stack JavaScript with MongoDB, Express, AngularJS, and Node.js",
"dependencies": {
"bootstrap": "~3",
"angular": "~1.3",
"angular-resource": "~1.3",
"angular-mocks": "~1.3",
"angular-bootstrap": "~0.11.2",
"angular-ui-utils": "~0.1.1",
"angular-ui-router": "~0.2.11",
"angular-material": "~0.10.0"
}
}
继承人的控制台错误信息:
错误:[$喷油器:modulerr]未能实例化模块ngMaterial由于:
错误:[$喷油器:NOMOD]模块'ngMaterial不可!你要么拼写错误的模块名称,或忘了加载它。如果注册一个模块,确保指定的依赖关系作为第二个参数。
Heres the console error message:Error: [$injector:modulerr] Failed to instantiate module ngMaterial due to:Error: [$injector:nomod] Module 'ngMaterial' 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.
角config.js文件:
Angular config.js file:
'use strict';
// Init the application configuration module for AngularJS application
var ApplicationConfiguration = (function() {
// Init module configuration options
var applicationModuleName = 'colign';
var applicationModuleVendorDependencies = ['ngResource', 'ui.router', 'ui.bootstrap', 'ui.utils', 'ngMaterial'];
// Add a new vertical module
var registerModule = function(moduleName, dependencies) {
// Create angular module
angular.module(moduleName, dependencies || []);
// Add the module to the AngularJS configuration file
angular.module(applicationModuleName).requires.push(moduleName);
};
return {
applicationModuleName: applicationModuleName,
applicationModuleVendorDependencies: applicationModuleVendorDependencies,
registerModule: registerModule
};
})();
在此先感谢您的帮助!
Thanks in advance for any help!
推荐答案
角料, ngMaterial
,对依赖 ngAria
和 ngAnimate
为好。您将需要加载它们。
Angular material, ngMaterial
, has dependency on ngAria
and ngAnimate
as well. You would need to load them.
angular.module('ngMaterial', ["ng","ngAnimate","ngAria", ...other material sub modules
您可以从和。使用基于您的角度版本的正确版本的这些。
You could download it from angular aria and angular animate. Use the correct version of these based on your angular version.
也正好在项目中加入脚本是不够的,你需要加载它们在你的HTML以及。 NG-材料
脚本之前也加载它们。
Also just adding the scripts in the project is not enough you need to load them in your html as well. Also load them before ng-material
script.
这篇关于安装角材料,与QUOT;无法实例化模块ngMaterial"即使我采用了棱角分明的版本1.3.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!