Open thibault opened 3 years ago
Edit: Had similar problem, but further troubleshooting showed it was an issue with differences in my settings for dev vs. prod.
I'd say it's from the documentation. There's no point in having a control if there is no layer. Maybe we should add that we need to create our own control in that case: var lc = L.control.layers().addTo(map);
Hi django-leaflet team,
I just installed django-leaflet and ran into an issue with a missing variable.
Context
I want to display a map with default values, and add an overlay layer. I followed the doc about adding overlays with js.
My code is pretty much exactly copy-pasted from the docs' excerpts.
In my settings:
Expected result
The overlay should display properly, according to the documentation.
Actual result
The console throws this error:
Uncaught TypeError: lc is undefined
It seems to me that, according to this line or this one, the line that defines the layersControl var is never reached if no layers or overlays are defined in django settings.
I'm not sure if this is a bug with django-leaflet or is something is missing from the documentation?
Thanks