bluehalo/ngx-leaflet-draw

Namespace leaflet.Draw has no exported member 'Control'

tmpacifitech opened this issue · 2 comments

<div 
    leaflet 
    leafletDraw
    [leafletOptions]="options" 
    (leafletMapReady)="onMapReady($event)"
    (leafletDrawCreated)="onMapDrawCreated($event)"
    class="map h-100"></div>


onMapDrawCreated(drawControl: Draw.Control) {
       console.log('add layer');
}

Here Draw.Control not found

This will depend on how you imported the leaflet-draw plugin. If you did something like:

import * as L from 'leaflet';
import 'leaflet-draw';

Then, you'd reference it as L.Draw.Control.

Or try

import {
  ...
  Draw,
  Control,
  DrawEvents
} from 'leaflet';

onMapDrawCreated(drawControl: Control.Draw) {
       console.log('add layer');
}