L.Routing is undefined, but L['default'].Routing works

Discussão em 'Angular' iniciado por ruese, Novembro 25, 2024.

  1. ruese

    ruese Guest

    I try to draw a route using leaflet v1.9.4 and leaflet-routing-machine v3.2.12. If I use it the common way with L.Routing.control(...) it throws an error:

    TypeError: Cannot read properties of undefined (reading 'control')


    If I use it with L['default'].Routing.control(...) it works.

    It's an Àngular 19 app. I've imported these packages

    import * as L from 'leaflet';
    import 'leaflet-routing-machine';


    If I insert console.info(L) I can see that Routing is missing from L itself but can be found under L['default'].

    What am I doing wrong?

    Continue reading...

Compartilhe esta Página