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.

Map doesn't display when creating a second time

See original GitHub issue

Maps 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:closed
  • Created 9 years ago
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
wf9a5m75commented, Sep 22, 2014

use map.remove() / map.getMap() in v1.2.0

0reactions
axelosoriocommented, Mar 3, 2016

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

<div id="mapaLocalsub" style="width:500px; height:450px; " ></div>

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:

$( "#mapaLocal" ).dialog({
      height: 450,
      width: 500,
      modal: true,
      close: function() {
      $( "#mapaLocal" ).html("<div id=\"mapaLocalsub\" style=\"width:500px;     height:450px; \" ></div>");
      }
});

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.

$( "#mapaLocal" ).html("<div id=\"mapaLocalsub\" style=\"width:500px;     height:450px; \" ></div>");
Read more comments on GitHub >

github_iconTop 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 >

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