Open Sidemenu and click again on the same page (GoogleMap page)
Page gets blank
ionViewDidLoad() {
this.loadMap();
}
loadMap() {
let element = document.getElementById(‘map’);
let map: GoogleMap = this.googleMaps.create(element, {});
let latlng = new LatLng(40.730610, -73.935242);
What do you mean by “the map to refresh”, what data do you want to refresh ? I had this kind of issue a while ago. I had a map on a page, and if I went back to the previous page and go again on the map page, without removing it, the map disappeared. I think it has something to do with CSS, try to find something about that.
But what does your code do when you click again on the map page link ? It opens a second page with another map ? Or stay on the same page but refresh data ?
When I click on the map page link again it stays on the same page but without the GoogleMaps (page gets blank). But when I go on antoher page and then on my map page it shows everything fine. The blank page comes when I click on my map page link twice. Is there a way i can fix that ?
Is the map loaded again when you click on the menu link for the second time ? I mean, is your function “loadMap” called every time you click on the link ? If it is, if your Google Map is initialized several times, it could be the problem.
Well, the best option is to not initialize the map several times. But it depends on why you need to click several times on the map link. If it is only to refresh data (like reset the data on the map), just use something like an event, don’t open the page again, don’t call your loadMap function again, just call a custom function that reset data.