JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://code.ionicframework.com/0.9.27/css/ionic.css">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css">
<script src="http://code.ionicframework.com/0.9.27/js/ionic.js"></script>
<script src="http://code.ionicframework.com/0.9.27/js/angular/angular.js"></script>
<script src="http://code.ionicframework.com/0.9.27/js/angular/angular-resource.min.js"></script>
<script src="http://code.ionicframework.com/0.9.27/js/angular/angular-sanitize.js"></script>
<script src="http://code.ionicframework.com/0.9.27/js/angular/angular-animate.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.0rc3/angular-animate.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.0rc3/angular-touch.js"></script>
<script src="http://code.ionicframework.com/0.9.27/js/angular-ui/angular-ui-router.js"></script>
<script src="http://code.ionicframework.com/0.9.27/js/ionic-angular.js"></script>
<script src="http://www.directiv.es/application/html/js/tombatossals/angular-leaflet-directive/angular-leaflet-directive.min.js"></script>
<script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script>
<!doctype html>
<html ng-app="demoapp">
<body>
<div ng-controller="MainCtrl">
<div id="map"></div>
<button class="button button-full button-positive" ng-click="openModal()">Open modal</button>
<script id="modal.html" type="text/ng-template">
<div class="modal">
<header class="bar bar-header bar-positive">
<h1 class="title">New Modal</h1>
</header>
<ion-content has-header="true" padding="true">
After close modal, try to close marker Popup
<button class="button button-full button-positive" ng-click="closeModal()">Close modal</button>
</ion-content>
</div>
</script>
</div>
</div>
</body>
</html>
CSS
#map {
height: 200px;
}
JavaScript
var map = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png').addTo(map);
var marker = L.marker(new L.LatLng(51.505, -0.09)).addTo(map);
marker.bindPopup("<b>Hello world!</b><br>I am a popup.").openPopup();
angular.module("demoapp", ["ionic","leaflet-directive","controllers"]);
angular.module('controllers',[]).controller('MainCtrl',['$scope','$ionicModal',
function($scope,$ionicModal) {
angular.extend($scope, {
london: {
lat: 51.505,
lng: -0.09,
zoom: 8
},
markers: {
main_marker: {
lat: 51,
lng: 0,
focus: true,
message: "Hey, drag me if you want",
title: "Marker",
draggable: true
}
}
});
$ionicModal.fromTemplateUrl('modal.html', function(modal) {
$scope.modal = modal;
}, {
// Use our scope for the scope of the modal to keep it simple
scope: $scope
});
// Test data
$scope.contacts = [
{ name: 'Gordon Freeman' },
{ name: 'Barney Calhoun' },
{ name: 'Lamarr the Headcrab' }
];
$scope.openModal = function() {
$scope.modal.show();
};
$scope.closeModal = function() {
$scope.modal.hide();
};
//Be sure to cleanup the modal
$scope.$on('$destroy', function() {
$scope.modal.remove();
});
}]);