angular-leaflet-directive icon indicating copy to clipboard operation
angular-leaflet-directive copied to clipboard

Multiple Maps break

Open enthusiasmus opened this issue 8 years ago • 0 comments

Hi tombatossals!

We use three leaflet-directives inside our angular app. With leafletData.getMap we access the map instance to set the bounds and trigger the resize event. We call leafletData.getMap on every route change to get the instance of the current directive, but the promise from getMap gets only sometimes resolved and so we can't access the new directive.

After removing the following listener from your directive it works!

      scope.$on('$destroy', function() {
        leafletMapDefaults.reset();
        map.remove();
        leafletData.unresolveMap(attrs.id);
      });

We also recognized that attrs.id is never set. Is there another way to fix this bug? best regards

enthusiasmus avatar Apr 10 '16 07:04 enthusiasmus