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

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

Open
bmulder-innoseis opened this issue Oct 29, 2024 · 1 comment

Comments

@bmulder-innoseis
Copy link

bmulder-innoseis commented Oct 29, 2024

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
Copy link
Author

bmulder-innoseis commented Oct 29, 2024

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

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

1 participant