我添加了另一个模块' checklist-model'它能够加载类似的配置。
错误:
未捕获错误:[$ injector:modulerr]无法实例化模块 mmxDashboardApp由于:错误:[$ injector:modulerr]失败 实例化模块angular-gridster由于:错误:[$ injector:nomod] 模块' angular-gridster'不可用!你要么拼错了 模块名称或忘记加载它。如果注册模块,请确保 您将依赖项指定为第二个参数。
Bower.json
{
"name": "mmx-dashboard",
"version": "0.0.0",
"dependencies": {
"angular": ">=1.2.*",
"json3": "~3.3.1",
"es5-shim": "~3.0.1",
"jquery": "~1.11.0",
"bootstrap": "~3.1.1",
"angular-resource": ">=1.2.*",
"angular-cookies": ">=1.2.*",
"angular-sanitize": ">=1.2.*",
"angular-route": ">=1.2.*",
"angular-bootstrap": "~0.11.0",
"font-awesome": ">=4.1.0",
"lodash": "~2.4.1",
"checklist-model" : "~0.2.4",
"nvd3" : ">=1.7.1",
"angular-gridster" : "~0.11.7"
},
"devDependencies": {
"angular-mocks": ">=1.2.*",
"angular-scenario": ">=1.2.*"
}
}
app.js
'use strict';
angular.module('mmxDashboardApp', [
'ngCookies',
'ngResource',
'ngSanitize',
'ngRoute',
'ui.bootstrap',
'checklist-model',
'angular-gridster'
])
.config(function ($routeProvider, $locationProvider) {
$routeProvider
.otherwise({
redirectTo: '/'
});
$locationProvider.html5Mode(true);
});
的index.html
<!-- bower:js -->
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
<script src="bower_components/lodash/dist/lodash.compat.js"></script>
<script src="bower_components/checklist-model/checklist-model.js"></script>
<script src="bower_components/d3/d3.js"></script>
<script src="bower_components/nvd3/build/nv.d3.js"></script>
<script src="bower_components/javascript-detect-element-resize/detect-element-resize.js"></script>
<script src="bower_components/angular-gridster/src/angular-gridster.js"></script>
<!-- endbower -->
答案 0 :(得分:1)
模块名称为'gridster'而非'angular-gridster'。
https://github.com/ManifestWebDesign/angular-gridster/blob/master/src/angular-gridster.js#L5
答案 1 :(得分:0)
'use strict';
angular.module('mmxDashboardApp', [
'ngCookies',
'ngResource',
'ngSanitize',
'ngRoute',
'ui.bootstrap',
'checklist-model',
'gridster' /* not 'angular-gridster'*/
])
.config(function ($routeProvider, $locationProvider) {
$routeProvider
.otherwise({
redirectTo: '/'
});
$locationProvider.html5Mode(true);
});