Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Layers Control and null as first argument

I am using Leaflet library and I want to add just overlay layer on the map and the first argument sholud be null, right?

But when I do this:

var layerControl = L.control.layers(null,overlay).addTo(this.mapa);

I get this error:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Argument of type 'null' is not assignable to parameter of type 'LayersObject | undefined'.

I am working in Angular 7 and it is .ts file.

Can I get some advice, please?

>Solution :

Try using undefined instead of null in the first argument.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading