Google Maps is grey

前端 未结 7 1175
名媛妹妹
名媛妹妹 2020-12-06 17:33

I am using google maps in a mobile application using html and javascript. When the I load the map I am only able to see 5% of the map in the upper left corner. 95% of the di

相关标签:
7条回答
  • 2020-12-06 18:03

    I had a similar question using angular 5
    I could only get the map to refresh / recreate by using a setTimeout AND a setZoom (even though the level is the same)

    // set timeout.
    setTimeout(() => {
        console.log("attempting refresh");
        google.maps.event.trigger(this.map, "resize");
        this.map.setZoom(8);
    },
    100);
    

    Working Plunker Here

    What's fascinating about the refresh, is that it moves the map the second time it is displayed. Google maps is clearly not bug free.

    0 讨论(0)
提交回复
热议问题