0

enter image description hereeven after using this.map.invalidateSize() the map tiles are not loaded completely. this is working perfectly fine with the older version of angular 7 any workaround?

sample of the code:

@ViewChild('mapwindow', { static: false}) mapElement: any;
   
    this.map = L.map(this.mapElement.nativeElement, {
          center: [20.593684, 78.96288],
          zoom: 10,
          zoomControl: true,
          trackResize: true,
          layers: [osm]
        }); 
    const baseLayers = {
        OSM: osm,
        Satellite: googleSat,
        Hybrid: googleHybrid,
        Terrain: googleTerrain
    };
    L.control.layers(baseLayers, null, { position: "topright", collapsed: true }).addTo(this.map);

    this.map.invalidateSize();
  • 1
    Does this answer your question? [leaflet map does not appear correctly until resize](https://stackoverflow.com/questions/53879753/leaflet-map-does-not-appear-correctly-until-resize) – Seth Lutske May 12 '21 at 15:38
  • Do you call invalidateSize _after_ the map container is mounted, displayed and has its final dimensions? – ghybs May 12 '21 at 15:45
  • yes it is called after the map container in ngAfterViewInit() – user7446266 May 12 '21 at 15:57
  • At this point it would probably be best to provide a live reproduction example, typically on StackBlitz or CodeSandbox. – ghybs May 13 '21 at 02:49

0 Answers0