L is "missing" and don´t know why

  angular, javascript, leaflet, ngx-leaflet

I will refactor this question because I did it this morning and I know was really bad formuled.

I´m making an Angular project with ngx-leaflet and I´m trying to implement the "leaflet-zoombox" library in the project.

I´ve installed this packages:

npm install leaflet @asymmetrik/ngx-leaflet leaflet-zoombox

I´ve read all the doc of the 3 packages but can´t find an answer for the problem L is not defined at (Leaflet Zoombox min JS file).

This is the component call on the html:

<div class="col grey p-0 m-0" leaflet (leafletMapReady)="onReady($event)" [leafletOptions]="options" [leafletZoomOptions]="zoomOptions"></div>

I´ve added the scripts on the angular.json file and this is a sample of (it´s pretty long so I want to focus on this part that is the one no working properly) what I´ve done on the component typescript file:

import * as L from 'node_modules/leaflet';
onReady(map: L.Map){

const options = {
  modal: true,
  title: 'Box area zoom',
  position: 'bottomright'
}

const zoomControl = L.control.zoomBox(options);
map.addControl(zoomControl);

Hope this one is more usefull than my last one.

Source: Angular Questions

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.