Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does it work with angular? #121

Open
patricia-martinez-imatia opened this issue Jun 3, 2019 · 2 comments
Open

Does it work with angular? #121

patricia-martinez-imatia opened this issue Jun 3, 2019 · 2 comments

Comments

@patricia-martinez-imatia

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

@Azbesciak
Copy link

Yes, it works as most (if not all) js libraries. But I didn't found any dedicated support for now.

@joshting
Copy link

joshting commented Apr 1, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants