未定义cordova-cordova.js已经加载:: Ionic [英] cordova is not defined - cordova.js has already been loaded :: Ionic

查看:153
本文介绍了未定义cordova-cordova.js已经加载:: Ionic的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在应用运行期间,这是我得到的:

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

现在,这让我感到困惑,但是我认为Ionic正在尝试在定义之前加载cordova.但是,这使我无法使用其他依赖于此条件的服务,所以我的问题是,是否有办法加载cordova异步,否则我的问题可能是什么?

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

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>

推荐答案

ng-cordova使用cordova,因此必须在以后加载:

ng-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-cordova.js已经加载:: Ionic的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆