Skip to content
This repository has been archived by the owner on Apr 7, 2020. It is now read-only.

Demo page throws error when deleting feature #16

Open
tomsaleeba opened this issue Apr 19, 2017 · 0 comments
Open

Demo page throws error when deleting feature #16

tomsaleeba opened this issue Apr 19, 2017 · 0 comments

Comments

@tomsaleeba
Copy link
Contributor

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 added a commit to tomsaleeba/ui-leaflet-draw that referenced this issue Apr 19, 2017
…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
nmccready added a commit that referenced this issue Jun 7, 2017
#16 fix for demo page throwing error on delete
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant