L.mapbox.markerLayer().clearLayers();
L.mapbox.markerLayer()
is a function that creates a new marker layer: this call is creating a new marker layer, and clearing the markers in it.
In your code, you have the lines
var markerLayer = L.mapbox.markerLayer().setGeoJSON({
type: 'FeatureCollection',
features: $scope.geo
}).addTo(map);
You are creating a new marker layer with the L.mapbox.markerLayer()
and naming it with the variable markerLayer
. So, to clear the markers in this layer, you would call:
markerLayer.clearLayers();