I’m trying to build an application using Ionic + ngCordova + PouchDB. However, it does not seem working using both ngCordova and PouchDB together.
I have tried to import these 2 libraries in different orders in the index.html to make them work, but unfortunately they are not working. Did any one experience such issue? thanks,
<script src="lib/pouchdb/dist/pouchdb.min.js"/>
<script src="lib/ngCordova/dist/ng-cordova.js"/>
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>
No error, when I do this: var app = angular.module('starter', ['ionic'])
However, I got an error when I try to add ngCordova…etc
var app = angular.module('starter', ['ionic','ngCordova'])
//Note I have checked no typo error in the ng-app name:
Error:
Uncaught Error: [$injector:modulerr] Failed to instantiate module starter due to:
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.
http://errors.angularjs.org/1.4.3/$injector/nomod?p0=ngCordova
at http://localhost:9000/lib/ionic/js/ionic.bundle.js:13380:12
at http://localhost:9000/lib/ionic/js/ionic.bundle.js:15270:17
at ensure (http://localhost:9000/lib/ionic/js/ionic.bundle.js:15194:38)
at module (http://localhost:9000/lib/ionic/js/ionic.bundle.js:15268:14)
at http://localhost:9000/lib/ionic/js/ionic.bundle.js:17674:22
at forEach (http://localhost:9000/lib/ionic/js/ionic.bundle.js:13648:20)
at loadModules (http://localhost:9000/lib/ionic/js/ionic.bundle.js:17658:5)
at http://localhost:9000/lib/ionic/js/ionic.bundle.js:17675:40
at forEach (http://localhost:9000/lib/ionic/js/ionic.bundle.js:13648:20)
at loadModules (http://localhost:9000/lib/ionic/js/ionic.bundle.js:17658:5)
http://errors.angularjs.org/1.4.3/$injector/modulerr?p0=ngCordova&p1=Error%…%3A%2F%2Flocalhost%3A9000%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17658%3A5)
at http://localhost:9000/lib/ionic/js/ionic.bundle.js:13380:12
at http://localhost:9000/lib/ionic/js/ionic.bundle.js:17697:15
at forEach (http://localhost:9000/lib/ionic/js/ionic.bundle.js:13648:20)
at loadModules (http://localhost:9000/lib/ionic/js/ionic.bundle.js:17658:5)
at http://localhost:9000/lib/ionic/js/ionic.bundle.js:17675:40
at forEach (http://localhost:9000/lib/ionic/js/ionic.bundle.js:13648:20)
at loadModules (http://localhost:9000/lib/ionic/js/ionic.bundle.js:17658:5)
at createInjector (http://localhost:9000/lib/ionic/js/ionic.bundle.js:17584:11)
at doBootstrap (http://localhost:9000/lib/ionic/js/ionic.bundle.js:14942:20)
at bootstrap (http://localhost:9000/lib/ionic/js/ionic.bundle.js:14963:12)
http://errors.angularjs.org/1.4.3/$injector/modulerr?p0=starter&p1=Error%3A…3A%2F%2Flocalhost%3A9000%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A14963%3A12)
I found the reason. I am using Ripple Emulator to test my app, and I found this issue happens there. When I opened it using ionic serve it worked fine…