angular verison: 8
version in package.json:
"leaflet": "1.5.1",
"leaflet-draw": "1.0.4",
"leaflet-sidebar-v2": "3.0.3",
"esri-leaflet": "2.3.2",
"leaflet-control-geocoder": "1.10.0"
I have import leaflet and other like this:
import * as L from 'leaflet';
import 'leaflet-draw';
import * as esri from 'esri-leaflet';
import 'leaflet-sidebar-v2';
import 'leaflet-control-geocoder';
Now i have to use or leaflet-control-geocoder to implement this function but if i write this:
L.control.geocoder().addTo(map);
angular crash.(Property 'geocoder' does not exist on type 'typeof Control') I try also with esri-leaflet-geocoder, but it's crash too.
any solution?
I had the same problem. I fixed it by doing so
import * as L from 'leaflet';
import Geocoder from 'leaflet-control-geocoder';
...
this.map = L.map('map', {
center: [staticLatLng.lat, staticLatLng.lng],
zoom: zoomLevel
});
const GeocoderControl = new Geocoder();
GeocoderControl.addTo(this.map);
GeocoderControl.on('markgeocode', function (e) {
console.log(e);
});
...