yagajs / leaflet-ng2

Angular.io integration of Leaflet
https://leaflet-ng2.yagajs.org
ISC License
66 stars 26 forks source link

Impossible add plugin leaflet-spin #444

Open juanmafont opened 4 years ago

juanmafont commented 4 years ago

I'm trying to add plugin leaflet-spin from here: https://github.com/makinacorpus/Leaflet.Spin

I had read https://github.com/yagajs/leaflet-ng2/issues/366 and similars, but I can't get add this simple plugin:

import * as L from 'leaflet';
import 'leaflet-spin';
import { MapComponent } from '@yaga/leaflet-ng2';

@Component({
    selector: 'app',
    template: `<yaga-map><!-- ... --></yaga-map>`
})

export class AppComponent implements AfterViewInit {
    @ViewChild(MapComponent) private mapComponent: MapComponent;

public ngAfterViewInit(): void {
        const spinPlugin = (L as any).Spinner();
        this.mapComponent.addControl(spinPlugin);
    }
}

but when I try to use I always got: Property 'Spinner' does not exist on type 'MapComponent'.

this.mapComponent.Spinner(true);

I try with other posibilities Spin(). spin() spinner() but not luck.

If possible add this plugin to yaga leaflet-ng2 ?

Thank you very much.

atd-schubert commented 3 years ago

Do you also import Spin.JS? I don't know this plugin, but it seems possible to add it to leaflet-ng2 at first glance