Cross Cross - 1 month ago 6
AngularJS Question

ionic.bundle.js break down into separate imports

We are gradually rewriting mobile html5 with Angular.js into Ionic framework. So we have got dozens of functions calling angular.js directly.

Ionic provides a bundle, which combined angular and ionic. We don't want use this bundled one.

As the Ionic CDN docs stated, http://code.ionicframework.com/, we can break down the bundle into separated files.

But no luck to get this work. I tried this on Ionic codepen demos, http://codepen.io/ionic/pen/tfAzj

i.e. I replaced

<script src="//code.ionicframework.com/nightly/js/ionic.bundle.js"></script>


by using:

<script src="//code.ionicframework.com/1.3.1/js/ionic-angular.js"></script>

<script src="//code.ionicframework.com/1.3.1/js/ionic.js"></script>


how to fix it? thanks.

Answer

Replace

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

With

<script src="lib/angular/angular.js"></script>
<script src="lib/angular-animate/angular-animate.js"></script>
<script src="lib/angular-sanitize/angular-sanitize.js"></script>
<script src="lib/angular-ui-router/release/angular-ui-router.js"></script>
<script src="lib/ionic/js/ionic.js"></script>
<script src="lib/ionic/js/ionic-angular.js"></script>

The order is important. You need all of those libraries, so add them if necessary.

Comments