Open Kamilius opened 8 years ago
Add onEachFeature to the geojson of http://tombatossals.github.io/angular-leaflet-directive/examples/0000-viewer.html#/basic/geojson-update-example
angular.extend($scope, {
center: { ... },
geojson : {
data: { ... },
style: { ... },
onEachFeature: function (feature, layer) {
layer.on({
click: function () {
// Fit the map to the bounds of the rectangle
leafletData.getMap().then(function (map) {
map.fitBounds(layer.getBounds());
});
// Or zoom in
if ($scope.center.zoom < 6) {
$scope.center.zoom ++;
}
}
})
}
}
});
When I'm double-clicking on region highlighted with help of attribute
geojson
, nothing happens. http://tombatossals.github.io/angular-leaflet-directive/examples/0000-viewer.html#/basic/geojson-update-exampleIf I'm doing same thing in original leaflet - http://leafletjs.com/examples/choropleth.html (ex. "Adding some color" example"), it zooms in.
Any tip on fixing this behavior?