cordova-plugin-googlemaps: Map doesn't display when creating a second time

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?

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

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