A
A
Artem2015-11-13 14:04:14
Angular
Artem, 2015-11-13 14:04:14

How to load a different set of libraries for different devices in the Ionic Framework, for example, connect js with a material design only for Android?

<!-- THIS LOAD FOR EVERYBODY -->
<script src="lib/ionic/js/ionic.bundle.js"></script>

<!-- NEXT LOAD ONLY FOR ANDROID NOT FOR IOS -->
<script src="lib/angular-material/angular-material.js"></script>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mark Doe, 2015-11-13
@mourr

use ionic.Platform , something like this

function loadAndroid(){
if(ionic.Platform.isAndroid()){
  var androidLib= document.createElement("script");
  androidLib.src = "lib/angular-material/angular-material.js";
  document.body.appendChild(androidLib);
}

}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question