Skip to content

Commit

Permalink
angular-ui#16 fixed from forked repo by removing the body of the dele…
Browse files Browse the repository at this point in the history
…ted handler function, it doesn't seem to need it. I added a display on the UI for the number of features in the layer and it does get decremented when deleting
  • Loading branch information
tomsaleeba committed Apr 19, 2017
1 parent 3987b69 commit d3771a0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<leaflet lf-center="map.center" lf-draw="map.drawOptions" height="480px" width="100%">
</leaflet>
<h1>ui-leaflet-draw</h1>
<p>Number of drawn features: {{drawnItemsCount()}}</p>
</body>
<script src="bower_components/leaflet/dist/leaflet.js"></script>
<script src="bower_components/leaflet-draw/dist/leaflet.draw-src.js"></script>
Expand All @@ -25,6 +26,10 @@ <h1>ui-leaflet-draw</h1>

var drawnItems = new L.FeatureGroup();

$scope.drawnItemsCount = function() {
return drawnItems.getLayers().length;
}

angular.extend($scope, {
map: {
center: {
Expand Down Expand Up @@ -71,11 +76,7 @@ <h1>ui-leaflet-draw</h1>
drawnItems.addLayer(leafletEvent.layer);
},
edited: function(arg) {},
deleted: function(arg) {
var layers;
layers = arg.layers;
drawnItems.removeLayer(layer);
},
deleted: function(arg) {},
drawstart: function(arg) {},
drawstop: function(arg) {},
editstart: function(arg) {},
Expand Down

0 comments on commit d3771a0

Please sign in to comment.