Open nmccready opened 9 years ago
Having the exact same problem. Getting around it by manually adding the control to the map instance.
Hi, I'm having the same problem (with controls like scale, draw, fullscreen...), so I also added the controls manually.
From @skray on September 27, 2015 3:19
I ran into this trying to use the Leaflet.draw plugin and was able to recreate it in this fiddle (click the 'Remove Controls' button to trigger the error).
If you have controls in your map and use the
controls
directive, like this:and then remove the control from the controls object later, like this:
This error is thrown:
It seems the culprit is this line, where it tries to call
map.hasControl()
, but I cannot find thehasControl
method defined in either the leaflet.js source or in this project.If this is just me misunderstanding how to work with controls, I'd love to know what I'm doing wrong. If this is a bug, I'd be happy to try to put a pull request in to fix it.
Copied from original issue: tombatossals/angular-leaflet-directive#962