ngCordova error $injector:modulerr on Android emulator not chrome


#1

I am trying to use the ngCordova wrapper for $cordovaNetwork. I get the following error “Error: [$injector:modulerr] Failed to instantiate module ngCordova due to:Error: [$injector:nomod] Module ‘ngCordova’ 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.” I have ng-cordova.js added before cordova.js in my index.html file and I have ngCordova listed before ionic for my angular dependencies. I get no error in the chrome emulator only on the Android emulator. I am trying to get the network connection type. I can perform this with out the wrapper with “navigator.connection.type”.Any help would be appreciated.


#2

I forgot to mention I am using phone gap build. I don’t know if it matters.Thanks.


#3

Using phonegap build could be the issue. I’m pretty sure that the cordova.js and phoengap.js are the same expect for that cordova has var cordova and phonegap has var phonegap.

Ng-cordova references cordova in it’s functions.

Can you try using regular cordova?


#4

Thanks for your answer. Using regular cordova fixed that error but when I test “$cordovaNetwork.isOnline()” when I turn my data connection off I get TypeError ‘undefined’. When my data is on everything works fine. Any ideas?


#5

I wrapped the call in the $ionicPlatform.ready function and it worked.Thanks