During the app running, this is what I get:
Uncaught ReferenceError: cordova is not defined
ionic-core.js:466 Ionic Core: init
ionic-core.js:145 Ionic Core: searching for cordova.js
ionic-core.js:149 Ionic Core: cordova.js has already been loaded
Now this is making me confused but I assume that Ionic is trying to load cordova before it is defined. However, this prevents me from using other services that rely on this condition, so my question is, is there a way to load cordova async or what else might be my problem?
index.html
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="lib/angular-websocket/angular-websocket.js"></script>
<script src="lib/ionic-service-core/ionic-core.js"></script>
<script src="lib/ionic-service-push/ionic-push.js"></script>
<script src="lib/facebook-connect-plugin/index.js"></script>
<!-- your app's js -->
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
<script src="js/services.js"></script>
<script src="js/utils.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="lib/ngCordova/dist/ng-cordova.min.js"></script>
<script src="cordova.js"></script>
During the app running, this is what I get:
Uncaught ReferenceError: cordova is not defined
ionic-core.js:466 Ionic Core: init
ionic-core.js:145 Ionic Core: searching for cordova.js
ionic-core.js:149 Ionic Core: cordova.js has already been loaded
Now this is making me confused but I assume that Ionic is trying to load cordova before it is defined. However, this prevents me from using other services that rely on this condition, so my question is, is there a way to load cordova async or what else might be my problem?
index.html
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="lib/angular-websocket/angular-websocket.js"></script>
<script src="lib/ionic-service-core/ionic-core.js"></script>
<script src="lib/ionic-service-push/ionic-push.js"></script>
<script src="lib/facebook-connect-plugin/index.js"></script>
<!-- your app's js -->
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
<script src="js/services.js"></script>
<script src="js/utils.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="lib/ngCordova/dist/ng-cordova.min.js"></script>
<script src="cordova.js"></script>
Share
Improve this question
asked Sep 24, 2015 at 16:32
lmenuslmenus
61310 silver badges27 bronze badges
2 Answers
Reset to default 4ng-cordova
uses cordova so it must be loaded later:
<script src="cordova.js"></script>
<script src="lib/ngCordova/dist/ng-cordova.min.js"></script>
cordova's plugin is designed for native plaform. So running ionic in a browser will fail all the plugins. That's the story.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744327177a4568706.html
评论列表(0条)