bluehalo / ngx-leaflet-markercluster

MIT License
61 stars 24 forks source link

No provider for _LeafletDirective after upgrade from Angular 16 to 18 #91

Open bmulder-innoseis opened 3 weeks ago

bmulder-innoseis commented 3 weeks ago

I've updated Angular to v17 and then v18, and then updated ngx-leaflet and ngx-leaflet-markercluster to their latest versions. Now, when I try to show a map in the browser, it is blank and I get the following error in the console:

ERROR NullInjectorError: R3InjectorError(_AppModule)[_LeafletDirective -> _LeafletDirective]: NullInjectorError: No provider for _LeafletDirective!

image

It used to be working, and I have LeafletDirective declared and imported as provider in my app.module.ts

My qc-map.component.html contains the following at the lines at which the error occurs:

<div leaflet app-map1 [leafletOptions]="options"
        [leafletBaseLayers]="baseLayers" [leafletLayersControlOptions]="layersControlOptions"
        [leafletMarkerCluster]="markers" [leafletMarkerClusterOptions]="markerClusterOptions"
        (leafletMarkerClusterReady)="markerClusterReady($event)" (leafletMapReady)="onMapReady($event)"
        (leafletZoomChange)="mapZoomed($event)" (leafletCenterChange)="mapMoved($event)"
        (leafletClick)="onMapClicked()">
</div>  

Any clues to what's wrong?

bmulder-innoseis commented 3 weeks ago

I tried downgrading to v17, and it does not occur there. The issue seems to be with v18