javascript - AngularJs/ngCordova Custom Build in ionic injection module error -


today went brink of insanity.

my goal include plugin ngcordova (in example: cordova-plugin-device). , little work.

my starting point project ionic tabs, nothing more.

following advice received first go website ngcordova, , build custom-ng cordova.js containing need (by device).

i integrates project location: /www/lib/ngcordova/dist/ng-cordova.js.

i change index.html follows:

... <!-- ionic/angularjs js --> <script src="lib/ionic/js/ionic.bundle.js"></script>  <script src="lib/ngcordova/dist/ng-cordova.js"></script> <!-- cordova script (this 404 during development) --> <script src="cordova.js"></script>  <!-- app's js --> <script src="js/app.js"></script>... 

i made dependency injection in application module this:

   angular.module('starter', ['ionic', 'starter.controllers', 'starter.services', 'ngcordova']) 

and finally, modify controller "dashctrl" integrate plugin:

 .controller('dashctrl', function($ionicplatform, $scope, $cordovadevice) {   $ionicplatform.ready(function() {     $scope.$apply(function() {             // binding not work! :/              // getting device infor $cordovadevice             var device = $cordovadevice.getdevice();              $scope.manufacturer = device.manufacturer;             $scope.model = device.model;             $scope.platform = device.platform;             $scope.uuid = device.uuid;            });    }); }) 

and error in browser (under ripple):

uncaught error: [$ injector: modulerr] failed instantiate starter unit due to: error: [$ injector: modulerr] failed instantiate ngcordova module due to: error: [$ injector: modulerr] failed instantiate ngcordova.plugins module due to: error: [$ injector: modulerr] failed instantiate module device due to: error: [$ injector: nomod] module 'device' not available! either misspelled name or forgot load module. if unit registering assurer specify dependencies second argument. 

the strange thing that, without touching in code, if a:

bower install ngcordova --save 

it downloads full version of ngcordova, , there, works perfectly.

i not see mistake. hope among me understand.

thank time took read message , time take answer (and sorry broken english).

it bug in build system.

open ngcordova.js file , change

    angular.module('ngcordova.plugins', [       'device'     ]); 

to

    angular.module('ngcordova.plugins', [       'ngcordova.plugins.device'     ]); 

Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -