错误:[$injector:nomod] Module 'nvd3'不可用
Error: [$injector:nomod] Module 'nvd3' is not available
我正在尝试实现这个Angular-nvD3图表。到目前为止,我有以下代码:
在我的主index.html我有以下脚本包括:
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/d3/d3.js"></script>
<script src="bower_components/nvd3/nv.d3.js"></script>
<script src="bower_components/angular-nvd3/dist/angular-nvd3.js"></script>
<script src="bower_components/angularjs-nvd3-directives/dist/angularjs-nvd3-directives.js"></script>
控制器:
'use strict';
/**
* @ngdoc function
* @name myApp.controller:DashboardCtrl
* @description
* # DashboardCtrl
* Controller of the myApp
*/
angular.module('myApp')
.controller('DashboardCtrl', function ($scope) {
// init data and option params for the chart
});
应用程序:
var myApp= angular
.module('myApp', ["nvd3"])
HTML视图:<div ng-app="myApp">
<div ng-controller="DashboardCtrl">
<nvd3 options="options" data="data"></nvd3>
</div>
</div>
我希望我包括所有相关的部分。
当我运行我的UI应用程序时,我得到这个错误:
Error: [$injector:nomod] Module 'nvd3' is not available
你知道我错过了什么吗?
此处回答:https://stackoverflow.com/a/37196430/3414722
这是javascript的一个缺失的依赖问题。在你的index.html中,加载外部库之后再加载app.js,因为angular模块无法实例化nvd3模块,因为它不存在。
相关文章:
- 为什么要对define.md和module.exports进行条件检查,以及条件何时通过
- Module.start()已激发两次
- 禁用NVD3 multiBarHorizontalChart中0值的工具提示
- module.js在运行iron节点时找不到模块
- NVD3.js多图形,具有固定的x轴和y轴
- ES6to5, ES6 Module Transpiler and Babel
- NVD3图表抑制隐藏图表的渲染
- 在jasmine规范中使用module.exports
- 在NVD3散点图上绘制标签
- 以角度nvd3折线图显示当前时间
- NVD3示例图表未显示
- 我们可以在一个js文件中有多个module.exports语句吗
- 显示灰度的 NVD3 图表
- module.exports一个jQuery插件
- Angular-nvD3条形图y轴缩放错误(AngularJS)
- 如何在nvd3中对条形图进行排序
- NVD3/D3派生变量
- NVD3.js-缺少X轴刻度
- d3.js&nvd3.js——如何设置y轴范围
- 错误:[$injector:nomod] Module 'nvd3'不可用