question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: " No provider for GoogleMapsAPIWrapper! "

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

19reactions
craftpipcommented, May 31, 2017

in your main module, add this

@NgModule({
    providers: [
        ...
        GoogleMapsAPIWrapper,
    ]
})

Hope this helps

0reactions
guisantoscommented, Apr 26, 2019

@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, ] })

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: " No provider for GoogleMapsAPIWrapper! " · Issue #1029
Hi, I've a problem since this morning: I used GoogleMapsAPIWrapper to make a test while coding. Finally I removed it because it was...
Read more >
No provider for MapsAPILoader in IONIC - Stack Overflow
I've got this error in ionic/angular project. Runtime Error No provider for MapsAPILoader! Stack Error: No provider for MapsAPILoader! at ...
Read more >
SebastianM/angular2-google-maps - Gitter
Hey there, I'm having an issue where one of my components fails to instantiate because of the error No provider for MapsAPILoader! in...
Read more >
GoogleMapsAPIWrapper - @agm/core
Creates a google.map.Rectangle for the current map. Parameters : Name, Type, Optional. options, google.maps.RectangleOptions, No ...
Read more >
No provider for HttpClient : r/angular - Reddit
No provider for HttpClient ... ERROR NullInjectorError: ... I am struck by the fact you have nothing in the "providers" section of the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found