AngularJS directive to embed an interact with maps managed by Leaflet library
Is it actually possible to cancel marker 'click' event without redrawing the marker itself? I'm trying to cancel it like this:
function disableMarkersEvents(events) {
var self = this;
if(typeof events !== 'object') {
events = [events];
}
$timeout(function() {
self.getMapScope().$apply(function() {
var map = self.getMap();
map.events.markers.disable = [].concat(events);
var len = map.events.markers.enable.length;
var idx;
while(len--) {
idx = _.indexOf(events, map.events.markers.enable[len]);
if(idx > -1) {
map.events.markers.enable.splice(idx, 1);
}
}
console.log(map);
})
});
}
Changes apply only after the marker is redrawn.
So, rather than
angular.extend($scope.data, {
markers: {
m1: {
lat: 51.505,
lng: -0.09,
compileMessage: false,
message: "I'm a static marker",
},
m2: {
lat: 51,
lng: 0,
focus: true,
message: "<div ng-include src=\"'views/template.html'\"></div>",
draggable: true,
},
m3: {
lat: 51,
lng: -1,
getMessageScope: function () { return $scope; },
message: "<p>{{data.angularInterpolatedMessage}}</p>",
compileMessage: true
}
}
});
};
is it possible to do:
angular.extend($scope.data, {
markers: [
m1: {
lat: 51.505,
lng: -0.09,
compileMessage: false,
message: "I'm a static marker",
},
m2: {
lat: 51,
lng: 0,
focus: true,
message: "<div ng-include src=\"'views/template.html'\"></div>",
draggable: true,
},
m3: {
lat: 51,
lng: -1,
getMessageScope: function () { return $scope; },
message: "<p>{{data.angularInterpolatedMessage}}</p>",
compileMessage: true
}
]
});
};