Dan*_*obe 16 javascript angularjs angular-material
这是非常令人沮丧的,我使用一个mean.js自耕农生成的应用程序,似乎无法得到角度材料启动和运行.我读了另一个关于Angularjs与材料设计问题的stackoverflow问题无法实例化模块ngMaterial.所以我更新了我的bower.json文件并运行了一个bower update和bower install.它仍然无法正常工作.在凉亭更新期间,bower给了我这条消息Unable to find a suitable version for angular, please choose one:,但我总是选择Angular 1.3.0或更高版本.
下面是我的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"
}
}
Run Code Online (Sandbox Code Playgroud)
下面是控制台错误消息:错误:[$ injector:modulerr]由于以下原因无法实例化模块ngMaterial:错误:[$ injector:nomod]模块'ngMaterial'不可用!您要么错误拼写了模块名称,要么忘记加载它.如果注册模块,请确保将依赖项指定为第二个参数.
Angular config.js文件:
'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
};
})();
Run Code Online (Sandbox Code Playgroud)
在此先感谢您的帮助!
PSL*_*PSL 35
角料,ngMaterial具有的依赖ngAria,并ngAnimate为好.你需要加载它们.
angular.module('ngMaterial', ["ng","ngAnimate","ngAria", ...other material sub modules
Run Code Online (Sandbox Code Playgroud)
您可以从角度咏叹调和角度动画下载它.根据角度版本使用正确的版本.
另外,仅在项目中添加脚本是不够的,您还需要在html中加载它们.还要在ng-material脚本之前加载它们.
| 归档时间: |
|
| 查看次数: |
26541 次 |
| 最近记录: |