2016-05-12 12 views
0

ich diesen Beitrag folgte: http://gonehybrid.com/bring-your-ionic-app-to-life-getting-started-with-d3-js/

ich alle Bibliotheken haben aber leider bekomme ich diesen Fehler:

Error: [$injector:modulerr] Failed to instantiate module starter due to: 
[$injector:modulerr] Failed to instantiate module nvd3 due to: 
[$injector:nomod] Module 'nvd3' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. 
http://errors.angularjs.org/1.5.3/$injector/nomod?p0=nvd3 
minErr/<@http://localhost:8100/lib/ionic/js/ionic.bundle.js:13415:12 
module/<@http://localhost:8100/lib/ionic/js/ionic.bundle.js:15381:17 
[email protected]://localhost:8100/lib/ionic/js/ionic.bundle.js:15305:38 
[email protected]://localhost:8100/lib/ionic/js/ionic.bundle.js:15379:14 
loadModules/<@http://localhost:8100/lib/ionic/js/ionic.bundle.js:17871:22 
[email protected]://localhost:8100/lib/ionic/js/ionic.bundle.js:13668:11 
[email protected]://localhost:8100/lib/ionic/js/ionic.bundle.js:17855:5 
loadModules/<@http://localhost:8100/lib/ionic/js/ionic.bundle.js:17872:40 
[email protected]://localhost:8100/lib/ionic/js/ionic 

Ubuntu 14.04 in VirtualBox auf meinem Win7 Maschine:

[email protected]:~/code/d3Examples/www/lib$ ls 
angular   angular-nvd3  angular-ui-router ionic 
angular-animate angular-sanitize d3     nvd3 
[email protected]:~/code/d3Examples/www/lib$ 

// Ionic Starter App 
 

 
// angular.module is a global place for creating, registering and retrieving Angular modules 
 
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html) 
 
// the 2nd parameter is an array of 'requires' 
 
angular.module('starter', [ 
 
    'ionic', 
 
    'nvd3' 
 
]) 
 

 
.run(function($ionicPlatform) { 
 
    $ionicPlatform.ready(function() { 
 
    if (window.cordova && window.cordova.plugins.Keyboard) { 
 
     // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard 
 
     // for form inputs) 
 
     cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); 
 

 
     // Don't remove this line unless you know what you are doing. It stops the viewport 
 
     // from snapping when text inputs are focused. Ionic handles this internally for 
 
     // a much nicer keyboard experience. 
 
     cordova.plugins.Keyboard.disableScroll(true); 
 
    } 
 
    if (window.StatusBar) { 
 
     StatusBar.styleDefault(); 
 
    } 
 
    }); 
 
})
<!DOCTYPE html> 
 
<html> 
 

 
<head> 
 
    <meta charset="utf-8"> 
 
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> 
 
    <title></title> 
 

 
    <link href="lib/ionic/css/ionic.css" rel="stylesheet"> 
 
    <link href="css/style.css" rel="stylesheet"> 
 

 
    <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above 
 
    <link href="css/ionic.app.css" rel="stylesheet"> 
 
    --> 
 

 
    <!-- ionic/angularjs js --> 
 
    <script src="lib/ionic/js/ionic.bundle.js"></script> 
 

 
    <!-- cordova script (this will be a 404 during development) --> 
 
    <script src="cordova.js"></script> 
 

 
    <!-- your app's js --> 
 
    <script src="js/app.js"></script> 
 
    <script src=”lib/d3/d3.js”></script> 
 
    <script src=”lib/nvd3/build/nv.d3.min.js”></script> 
 
    <script src=”lib/angular-nvd3/dist/angular-nvd3.min.js”></script> 
 
    <link rel=”stylesheet” href=”lib/nvd3/build/nv.d3.css”> 
 

 
</head> 
 

 
<body ng-app="starter"> 
 

 
    <ion-pane> 
 
    <ion-header-bar class="bar-stable"> 
 
     <h1 class="title">Ionic Blank Starter</h1> 
 
    </ion-header-bar> 
 
    <ion-content> 
 
    </ion-content> 
 
    </ion-pane> 
 
</body> 
 

 
</html>

Antwort

2

Dies ist ein fehlendes Abhängigkeitsproblem von Javascript. Laden Sie in Ihrem index.html Ihre app.js, nachdem Sie die externen Bibliotheken laden, weil angular Modul nicht in der Lage ist, das nvd3-Modul zu instanziieren, weil es nicht da ist.

Dies sollte Ihr index.html

<!DOCTYPE html> 
<html> 

<head> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> 
    <title></title> 

    <link href="lib/ionic/css/ionic.css" rel="stylesheet"> 
    <link rel=”stylesheet” href=”lib/nvd3/build/nv.d3.css”> 
    <link href="css/style.css" rel="stylesheet"> 

    <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above 
    <link href="css/ionic.app.css" rel="stylesheet"> 
    --> 

    <!-- ionic/angularjs js --> 
    <script src="lib/ionic/js/ionic.bundle.js"></script> 

    <!-- cordova script (this will be a 404 during development) --> 
    <script src="cordova.js"></script> 

    <script src=”lib/d3/d3.js”></script> 
    <script src=”lib/nvd3/build/nv.d3.min.js”></script> 
    <script src=”lib/angular-nvd3/dist/angular-nvd3.min.js”></script> 
    <!-- your app's js --> 
    <script src="js/app.js"></script> 

</head> 

<body ng-app="starter"> 

    <ion-pane> 
    <ion-header-bar class="bar-stable"> 
     <h1 class="title">Ionic Blank Starter</h1> 
    </ion-header-bar> 
    <ion-content> 
    </ion-content> 
    </ion-pane> 
</body> 

</html> 
sein