luca.p.alexandru
luca.p.alexandru

Reputation: 1750

Ionic undefined plugin from cordova

I have an Ionic app and in the index.html file I have the following

<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>

<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js" async="false"></script>

<!-- your app's js -->
<script src="js/app.js" async="false"></script>
<script src="js/controllers.js" async="false"></script>
<script src="js/services.js" async="false"></script>

The issue is that in cordova.js I have a plugin that does get initialized only after the controllers.js file is downloaded and executed, thus if I want to use that plugin in the controllers I can't because of an undefined error.

How can I make the controllers, app and services scripts load only after the cordova.js script has been downloaded and executed?

Thanks

Upvotes: 0

Views: 119

Answers (1)

Mohsin Muzawar
Mohsin Muzawar

Reputation: 1212

Load it in this order

<script type="text/javascript" src="cordova.js"></script>
 <script src="ionic.bundle.js"></script>

module

directive

service

controller

Upvotes: 0

Related Questions