From d3771a060017b46b2fb5fc0a84e7ac76afaeb22c Mon Sep 17 00:00:00 2001 From: Tom Saleeba Date: Wed, 19 Apr 2017 13:33:57 +0930 Subject: [PATCH] #16 fixed from forked repo by removing the body of the deleted 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 --- index.html | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 7243790..9c683fb 100644 --- a/index.html +++ b/index.html @@ -9,6 +9,7 @@

ui-leaflet-draw

+

Number of drawn features: {{drawnItemsCount()}}

@@ -25,6 +26,10 @@

ui-leaflet-draw

var drawnItems = new L.FeatureGroup(); + $scope.drawnItemsCount = function() { + return drawnItems.getLayers().length; + } + angular.extend($scope, { map: { center: { @@ -71,11 +76,7 @@

ui-leaflet-draw

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) {},