Hello !
I’m working on an app using Cordova, Leaftlet and Ionic.
Here is my code in controllers.js :
//map
.controller('MapCtrl', function($scope, $rootScope, $state, $ionicNavBarDelegate, geolocation, notif) {
// Change the title bar content
$scope.viewTitle = "<img src='img/map.svg' class='nav-title-icon'/>Confirmer la position";
$scope.initMap = function() {
var map = new L.map('map');
var osmURL = 'http://{s}.hide/hide/{z}/{x}/{y}.png';
var osmAttrib = 'Map data © OpenStreetMap contributors';
var osm = new L.TileLayer(osmUrl, { attribution: osmAttrib });
map.setView(new L.LatLng(47.12, 01.13), 11);
map.addLayer(osm);
}
});
And my html code for the map state :
<ion-view title="MAP">
<ion-nav-buttons side="right">
<button class="button button-icon icon ion-checkmark-round stable" ng-click="confirmPosition()"></button>
</ion-nav-buttons>
<ion-content>
<div id="map"></div>
</ion-content>
</ion-view>
When I emulate my app using cordova emulate ios
it displays this :
If I put my $scope.initMap = function() on commentary it displays this :
This is the first time I work with js, cordova and ionic. Can you give me some tips please ?
Thank you !