Open patricia-martinez-imatia opened 5 years ago
Yes, it works as most (if not all) js libraries. But I didn't found any dedicated support for now.
Found solution on my own. Where I import 'leaflet-contextmenu', I manually added the type definition called leaflet-contextmenu.d.ts with the following content:
declare namespace L {
interface ContextMenuItem {
text: string;
index?: number
callback?: (ev: ContextMenuItemClickEvent) => void;
}
interface MapOptions {
contextmenu: boolean;
contextmenuItems: ContextMenuItem[]
}
interface MarkerOptions {
contextmenu: boolean;
contextmenuItems: ContextMenuItem[]
}
interface ContextMenuItemClickEvent {
latlng: LatLng;
layerPoint: Point;
containerPoint: Point;
relatedTarget: Marker | Path | undefined;
}
}
Now, I am able to declare those options, compile and the plugin works. Tested in react with TS, it should work with Angular too.
Does This library work with angular? I saw examples with angularjs but none with angular.
If so, there is an example to follow.
Thanks you