あまりお役に立てなくてすみません。私は AngularJS-Leaflet-Directive + Ionic Framework を使用しています。参照用に、サンプル コードの一部 (2 つのマップ用) を次に示します。
var greenIcon;
var greenIcon2;
$scope.closeAddMarker = function()
{
$scope.modal.hide();
$scope.clearFile();
$scope.removeGreenIcon();
}
$scope.addMarker = function(locationEvent)
{
$scope.newLocation = new Location();
$scope.newLocation.lat = locationEvent.leafletEvent.latlng.lat;
$scope.newLocation.lng = locationEvent.leafletEvent.latlng.lng;
var markerIcon = L.icon(
{
iconUrl: 'lib/leaflet/images/location-marker.png',
shadowUrl: 'lib/leaflet/images/marker-shadow.png',
iconSize: [25, 41], // size of the icon
shadowSize: [41, 41] // size of the shadow
});
//check valid user
if(localStorage.getItem("username"))
{
leafletData.getMap("map1").then(function(map1)
{
greenIcon = L.marker([Number($scope.newLocation.lat), Number($scope.newLocation.lng)], {icon: markerIcon}).addTo(map1);
});
leafletData.getMap("map2").then(function(map2)
{
greenIcon2 = L.marker([Number($scope.newLocation.lat), Number($scope.newLocation.lng)], {icon: markerIcon}).addTo(map2);
});
}
$scope.modal.show();
}
$scope.removeGreenIcon = function()
{
leafletData.getMap("map1").then(function(map1)
{
if(greenIcon != null)
{
map1.removeLayer(greenIcon);
greenIcon =null;
}
});
leafletData.getMap("map2").then(function(map2)
{
if(greenIcon2 != null)
{
map2.removeLayer(greenIcon2);
greenIcon2 =null;
}
});
};