admin管理员组文章数量:1405331
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.
本文标签: javascriptcordova is not definedcordovajs has already been loadedIonicStack Overflow
版权声明:本文标题:javascript - cordova is not defined - cordova.js has already been loaded :: Ionic - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744327176a2600784.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论