Map doesn't display when creating a second time
See original GitHub issueMaps don’t seem to display a second time. Here’s an Angular directive I’m using to test it:
.directive('map', function () {
return {
restrict: 'E',
link: function (scope, el, attrs) {
var map;
el.on('$destroy', function () {
console.log('destroy called');
map.setDiv(null);
});
document.addEventListener('deviceready', function () {
console.log('device ready, build map');
map = plugin.google.maps.Map.getMap(el[0]);
}, false);
}
}
});
The first time, everything runs great and a map shows up. When the <map> element disappears, I call map.setDiv() and the map disappears.
Now, when the <map> element gets added again, the logs show the map should be built, and no errors are thrown, but no map shows up.
Any ideas?
Issue Analytics
- State:
- Created 9 years ago
- Comments:16 (9 by maintainers)
Top Results From Across the Web
Google map not rendering second time - Stack Overflow
I am using controller to show google map in my application. When I load the page first time the map is rendering properly....
Read more >The aerial Bing map is not displayed in Civil 3D and Map 3D ...
Issue: A drawing with a coordinate system applied does not show an aerial map (Bing map) in Civil 3D and AutoCAD Map 3D....
Read more >How to fix Maps when it crashes - Android - Google Maps Help
If the Google Maps app on your phone or tablet crashes or has other issues that affect your experience on Maps, try the...
Read more >Map Visualization Not Working - Microsoft Power BI Community
Solved: Two days ago, this map displayed correctly when going through one of the tutorials. Yesterday and today, I was trying to create...
Read more >If Maps isn't working on your Apple device
Make sure Location Services is on, and make sure Maps is set to While Using the App or Widgets. Set the date, time,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
use map.remove() / map.getMap() in v1.2.0
I’m using Jquery to remove div code. In my case I was using the jquery dialog, then when I close the dialog I’m replacing the html from the div (where google maps is showing the map) with the original div code.
My original div code was
I notice that after google maps was working it fills the div with a lot of things and style, then in the close function from my Jquery.dialog I’m replacing the html with my original div code:
But of course, you can use the Jquery html method in a function that you call when close the function or before creating your map, hope it helps.