I use angularjs and leaflet.js.
In my controller I set a listener on the leaflet map zoom :
map.on("zoomend", function () {
refreshData(...); // use the zoom & bound to get data.
});
The refreshData() refresh the markers displayed in the map according to many criteria ( facets ) and re adjust the map with setView(). ( refreshData() can also be called by other function )
var refreshData = function(){
// lot of thinks...
map.setView(new L.LatLng(lat,lon),zoomlevel);
}
So when refreshData is called i want to disable the map.on("zoomend") listener because it make a cyclic call.
How to do this ?