Skip to content

Commit

Permalink
fix(core): Fixed a map destroy bug reported by @porjo here:
Browse files Browse the repository at this point in the history
  • Loading branch information
tombatossals committed Sep 11, 2014
1 parent 5e6b73b commit 7255d91
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
4 changes: 1 addition & 3 deletions dist/angular-leaflet-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ angular.module("leaflet-directive", []).directive('leaflet', ["$q", "leafletData
});

scope.$on('$destroy', function () {
leafletData.getMap().then(function(map) {
map.remove();
});
map.remove();
leafletData.unresolveMap(attrs.id);
});
}
Expand Down
4 changes: 2 additions & 2 deletions dist/angular-leaflet-directive.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/double-map-toggle-example.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@
<h1>Toggle between two maps on screen</h1>
<p>View javascript console while toggling map</p>
<button ng-click="togglemap = !togglemap">Toggle Map</button>
<div ng-if="togglemap" ng-controller="map1">
<div ng-if="!togglemap" ng-controller="map1">
<h2>Map1</h2>
<leaflet id="map1" center="center" paths="paths" width="400px" height="320px"></leaflet>
</div>
<div ng-if="!togglemap" ng-controller="map2">
<div ng-if="togglemap" ng-controller="map2">
<h2>Map2</h2>
<leaflet id="map2" center="center" paths="paths" width="400px" height="320px"></leaflet>
</div>
Expand Down
4 changes: 1 addition & 3 deletions src/directives/leaflet.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,7 @@ angular.module("leaflet-directive", []).directive('leaflet', function ($q, leafl
});

scope.$on('$destroy', function () {
leafletData.getMap().then(function(map) {
map.remove();
});
map.remove();
leafletData.unresolveMap(attrs.id);
});
}
Expand Down

1 comment on commit 7255d91

@stefanmdt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tombatossals, now this issue reappears: #592

It was also mentioned here: #539

And here is the initial change: 380b039

Did I miss some changes that fix the initial problem?

Thanks in advance ...

Please sign in to comment.