How do I add mapbox.js to my ionic/cordova app? -


i been struggling getting work , can result map without css applied it. have not been able find info on how this.

<!doctype html> <html>     <head>         <meta charset="utf-8">         <meta name="viewport"         content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">         <title></title>          <link href="lib/ionic/css/ionic.css" rel="stylesheet">         <link href='css/mapbox.css' rel='stylesheet'/>         <link href="css/style.css" rel="stylesheet">          <script src="lib/ionic/js/ionic.bundle.js"></script>         <script src="cordova.js"></script>         <script src="js/app.js"></script>     </head>      <body ng-app="starter" class="platform-android platform-cordova platform-webview">      <ion-pane>         <ion-header-bar class="bar-stable">             <h1 class="title">ionic blank starter</h1>         </ion-header-bar>          <ion-content ng-controller="mapctrl">             <div id='map'></div>          </ion-content>     </ion-pane>     <script src='js/mapbox.js'></script> </body> 

angular.module('starter', ['ionic'])  .run(function($ionicplatform) {  $ionicplatform.ready(function() { if(window.cordova && window.cordova.plugins.keyboard) {    cordova.plugins.keyboard.hidekeyboardaccessorybar(true);    cordova.plugins.keyboard.disablescroll(true); } if(window.statusbar) {   statusbar.styledefault(); }  }); })  .controller('mapctrl', function($scope) {  l.mapbox.accesstoken =  'pk.eyj1ijoiywfqiiwiysi6imyzmjm1y2mzmtq3owfknmmymtawnwywowizntazywziin0.sig2x4e8zhxu5jonf0jj3w';  var southwest = l.latlng(40.712, -74.227), northeast = l.latlng(40.774, -74.125), bounds = l.latlngbounds(southwest, northeast);  var map = l.mapbox.map('map', 'mapbox.streets', {  maxbounds: bounds, maxzoom: 19, minzoom: 10 });   map.fitbounds(bounds);  }); 

when excluding css file, get:

enter image description here

with css file, blank screen.

i able pull working .apk emulator. believe problem order calling scripts in.

working version inlined js:

<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport"       content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> <title></title>  <link href="lib/ionic/css/ionic.css" rel="stylesheet"> <link href="css/style.css" rel="stylesheet">  <script src='js/mapbox.js'></script> <link href='css/mapbox.css' rel='stylesheet'/> <style>     body { margin:0; padding:0; }     #map { position:absolute; top:0; bottom:0; width:100%; } </style>  <!-- if using sass (run gulp sass first), uncomment below , remove css includes above <link href="css/ionic.app.css" rel="stylesheet"> -->  <!-- ionic/angularjs js --> <script src="lib/ionic/js/ionic.bundle.js"></script>  <!-- cordova script (this 404 during development) --> <script src="cordova.js"></script>  <!-- app's js --> <script src="js/app.js"></script> </head> <body ng-app="starter" class="platform-android platform-cordova platform-webview">  <ion-pane>     <ion-header-bar class="bar-stable">     <h1 class="title">map test</h1> </ion-header-bar>  <ion-content>     <div id='map'></div>   </ion-content> </ion-pane> <script>     l.mapbox.accesstoken = 'pk.eyj1ijoiywfqiiwiysi6imyzmjm1y2mzmtq3owfknmmymtawnwywowizntazywziin0.sig2x4e8zhxu5jonf0jj3w';         var map = l.mapbox.map('map',             'mapbox.streets', {                 zoomcontrol: false                     }).setview([44.6437138,-63.5854978], 11); 


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -