[英]Error: [$injector:nomod] Module 'nvd3' is not available
I'm trying to implement this Angular-nvD3 chart . 我正在尝试实现此Angular-nvD3图表 。 So far I have the following code:
到目前为止,我有以下代码:
in my main index.html I have the following scripts included: 在主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>
Controller: 控制器:
'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
});
Apps: 应用:
var myApp= angular
.module('myApp', ["nvd3"])
HTML view: HTML视图:
<div ng-app="myApp">
<div ng-controller="DashboardCtrl">
<nvd3 options="options" data="data"></nvd3>
</div>
</div>
I hope that I include all relevant parts. 我希望我包括所有相关部分。
When I run my UI app I'm getting this error: 当我运行我的UI应用程序时,出现此错误:
Error: [$injector:nomod] Module 'nvd3' is not available
Any ideas what am I missing? 有什么想法我想念的吗?
Answered here: https://stackoverflow.com/a/37196430/3414722 在这里回答: https : //stackoverflow.com/a/37196430/3414722
This is a missing dependency issue of javascript.
这是缺少的javascript依赖性问题。 In your index.html, load your app.js after you load the the external libraries, because angular module isn't able to instantiate the nvd3 module because it isn't there.
在您加载外部库之后,在index.html中加载app.js,这是因为angular模块无法实例化nvd3模块,因为该模块不存在。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.