bluehalo / ngx-leaflet-draw

MIT License
89 stars 30 forks source link

Namespace leaflet.Draw has no exported member 'Control' #71

Closed tmpacifitech closed 5 years ago

tmpacifitech commented 5 years ago
<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

reblace commented 5 years ago

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.

benboughton1 commented 4 years ago

Or try

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

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