Hi,
I've a problem since this morning: I used GoogleMapsAPIWrapper to make a test while coding. Finally I removed it because it was useless for me.
But now i've this error: No provider for GoogleMapsAPIWrapper! On all of my files which use it. But it was working perfectly before, and I haven't touch to these files ...
To resolve this error I put it as a provider
@Directive({
selector: 'marker-cluster-congelateurs',
providers: [GoogleMapsAPIWrapper]
})
But now my clusterer doesn't work anymore ... Any ideas ?
Thanks
Code of my clusterer:
`this.gmapsApi.getNativeMap().then(map => {
console.log('in');
let style1 = {
url: "assets/icons/map/autre/c_commande.png",
height: 40,
width: 40,
textColor: '#000',
textSize: 14,
backgroundPosition: "center center"
};
let style2 = {
url: "assets/icons/map/autre/c_commande.png",
height: 40,
width: 40,
textColor: '#000',
textSize: 16,
backgroundPosition: "center center"
};
let style3 = {
url: "assets/icons/map/autre/c_commande.png",
height: 40,
width: 40,
textColor: '#000',
textSize: 18,
backgroundPosition: "center center"
};
// Options du clusterer
// gridSize correspond 脿 la taille de la zone qu'englobe le cluster
// styles a 3 style: un pour chaque niveau de zoom du cluster
let options = {
gridSize: 50,
styles: [style1, style2, style3]
};
let infowindow = new google.maps.InfoWindow();
var that = this;
Observable
.interval(100)
.take(1)
.subscribe(() => {
// Clear des markers pour actualisation
if(this.markerCluster) {
this.markerCluster.clearMarkers();
this.markers = [];
}
if (this.points.length > 0) {
for (let point of this.points) {
if( point.latitude!=0 || point.longitude!=0){
// En fonction de si le mode couleur est actif ou non, le path est diff茅rent
let iconePath;
if(this.colorMod){
iconePath = point.iconeCouleur;
}
else{
iconePath = point.icone;
}
let markerIcon = {
url: "assets/icons/map/commandes/"+iconePath,
scaledSize: new google.maps.Size(25, 36)
}
let marker = new google.maps.Marker({
position: new google.maps.LatLng(point.latitude, point.longitude),
label: point.idCommande+"",
icon: markerIcon
});
// Clic event pour afficher l'infobulle
google.maps.event.addListener(marker, 'click', (function(marker: any) {
return function() {
infowindow.setContent(" "+point.infoBulle);
infowindow.open(map, marker);
that.notify.emit(point);
}
})(marker));
this.markers.push(marker);
}
}
}
// Clear des markers pour actualisation
else {
this.markers = [];
if (this.markerCluster) {
this.markerCluster.clearMarkers();
}
}
this.markerCluster = new MarkerClusterer(map, this.markers, options);
})
});
`
The console.log('in') isn't even showing something
in your main module,
add this
@NgModule({
providers: [
...
GoogleMapsAPIWrapper,
]
})
Hope this helps
I added the wrapper to my main module and i still get errors saying
"EXCEPTION: Uncaught (in promise): Error: Error in ./MapPageComponent class MapPageComponent - inline template:29:12 caused by: No provider for GoogleMapsAPIWrapper!
Error: Error in ./MapPageComponent class MapPageComponent - inline template:29:12 caused by: No provider for GoogleMapsAPIWrapper!
at ViewWrappedError"
What i'm basically trying to do is add markers on clicking the map, and clustering them in real time, i don't even know if logically speaking, this feature is possible?
@sadeajayi, were you able to find a fix...Iam having a similar error
Error: StaticInjectorError(AppMModule)[ClusterManager -> GoogleMapsAPIWrapper]:
StaticInjectorError(Platform: core)[ClusterManager -> GoogleMapsAPIWrapper]:
NullInjectorError: No provider for GoogleMapsAPIWrapper!
thanks
@sadeajayi, were you able to find a fix...Iam having a similar error
Error: StaticInjectorError(AppMModule)[ClusterManager -> GoogleMapsAPIWrapper]:
StaticInjectorError(Platform: core)[ClusterManager -> GoogleMapsAPIWrapper]:
NullInjectorError: No provider for GoogleMapsAPIWrapper!thanks
You need to do this
@NgModule({
providers: [
...
GoogleMapsAPIWrapper,
]
})
Most helpful comment
in your main module,
add this
Hope this helps