繁体   English   中英

错误:[$ injector:nomod]模块“ 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模块,因为该模块不存在。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM