krispo / angular-nvd3

AngularJS directive for NVD3 reusable charting library (based on D3). Easily customize your charts via JSON API.
http://krispo.github.io/angular-nvd3
MIT License
1.29k stars 377 forks source link

Unknown provider: nvd3Provider <- nvd3 <- clientDashBoardPageCtrl #761

Open Hanwen196 opened 5 years ago

Hanwen196 commented 5 years ago

Hi, I am trying to incorporate angular-nvd3. But it seems missing something. Can you give me a help?

It said "Unknown provider: nvd3Provider <- nvd3 <- clientDashBoardPageCtrl"

I am using angular 1.5x, and some essential code is below.

in my app.js

var myApp = angular.module('myApp',[/*'ngRoute',*/
                                    'ngAnimate',
                                    'ngResource',
                                    'ui.router',
                                    'nvd3']);

in the controller.js

myApp.controller('clientDashBoardPageCtrl', 

    ['$scope', '$state',
        'emitEventNameService', 'urlService', 'nvd3',

    function($scope, $state,
        emitEventNameService, urlService, nvd3,
        ) {

in index.html

    <script src="node_modules/angular/angular.js"></script>
    <script src="node_modules/d3/d3.js"></script>
    <script src="node_modules/nvd3/build/nv.d3.js"></script> <!-- or use another assembly -->
    <script src="node_modules/angular-nvd3/dist/angular-nvd3.js"></script>
    <link rel="stylesheet" href="node_modules/nvd3/build/nv.d3.css">