ui-leaflet-draw icon indicating copy to clipboard operation
ui-leaflet-draw copied to clipboard

Demo page throws error when deleting feature

Open tomsaleeba opened this issue 8 years ago • 0 comments

Steps:

  • open the index.html demo page
  • draw a feature
  • delete the feature
  • check the JS console

Expected: The feature is deleted and no errors are shown in the console.

Actual: The feature is deleted but the following error is shown in the console

angular.js:12477 ReferenceError: layer is not defined
    at Object.deleted ((index):77)
    at (index):95
    at n.$emit (angular.js:16238)
    at ui-leaflet.js:4951
    at n.$eval (angular.js:15989)
    at n.$digest (angular.js:15800)
    at angular.js:16028
    at e (angular.js:5507)
    at angular.js:5784

The problem is the drawnItems.removeLayer(layer); line. I've found that making the whole deleted handler function a NOOP one like most of the others fixes the problem. The feature is deleted and no errors are thrown. I'll submit a pull request.

tomsaleeba avatar Apr 19 '17 03:04 tomsaleeba