简体   繁体   English

错误:[$ injector:nomod]模块“ nvd3”不可用

[英]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.

相关问题 错误:[$ injector:nomod]模块不可用 - Error: [$injector:nomod] Module is not available Angular / Karma:错误:[$ injector:nomod]模块&#39;模块&#39;不可用 - Angular/Karma: Error: [$injector:nomod] Module 'module' is not available AngularJS:未捕获的错误:[$injector:nomod] 模块 _ 不可用! | 对模块的多次引用 - AngularJS: Uncaught Error: [$injector:nomod] Module _ is not available! | Multiple References to Module Angular JS错误:[$ injector:nomod]模块&#39;portfolioMockupApp.services&#39;不可用 - Angular JS Error: [$injector:nomod] Module 'portfolioMockupApp.services' is not available “错误:$ injector:nomod模块不可用” - “Error: $injector:nomod Module Unavailable” 我的控制台中的错误-[$ injector:modulerr]由于以下原因而无法实例化模块启动器:[$ injector:nomod]模块&#39;starter&#39;不可用 - Error in my console - [$injector:modulerr] Failed to instantiate module starter due to: [$injector:nomod] Module 'starter' is not available 错误:[$ injector:modulerr]由于以下原因而无法实例化模块myApp:[$ injector:nomod]模块&#39;ui.bootstrap&#39;不可用 - Error: [$injector:modulerr] Failed to instantiate module myApp due to: [$injector:nomod] Module 'ui.bootstrap' is not available `[$$ jector:nomod]模块“ google-maps”不可用。 - `[$injector:nomod] Module 'google-maps' is not available` AngularJS:[$ injector:nomod]模块&#39;uiRouter&#39;不可用 - AngularJS: [$injector:nomod] Module 'uiRouter' is not available $ injector:nomod模块&#39;app&#39;不可用! 仅Firefox - $injector:nomod Module 'app' is not available! Firefox Only
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM