Skip to content

Commit 7255d91

Browse files
committed
fix(core): Fixed a map destroy bug reported by @porjo here:
#471
1 parent 5e6b73b commit 7255d91

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

dist/angular-leaflet-directive.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@ angular.module("leaflet-directive", []).directive('leaflet', ["$q", "leafletData
107107
});
108108

109109
scope.$on('$destroy', function () {
110-
leafletData.getMap().then(function(map) {
111-
map.remove();
112-
});
110+
map.remove();
113111
leafletData.unresolveMap(attrs.id);
114112
});
115113
}

dist/angular-leaflet-directive.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/double-map-toggle-example.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@
7171
<h1>Toggle between two maps on screen</h1>
7272
<p>View javascript console while toggling map</p>
7373
<button ng-click="togglemap = !togglemap">Toggle Map</button>
74-
<div ng-if="togglemap" ng-controller="map1">
74+
<div ng-if="!togglemap" ng-controller="map1">
7575
<h2>Map1</h2>
7676
<leaflet id="map1" center="center" paths="paths" width="400px" height="320px"></leaflet>
7777
</div>
78-
<div ng-if="!togglemap" ng-controller="map2">
78+
<div ng-if="togglemap" ng-controller="map2">
7979
<h2>Map2</h2>
8080
<leaflet id="map2" center="center" paths="paths" width="400px" height="320px"></leaflet>
8181
</div>

src/directives/leaflet.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,7 @@ angular.module("leaflet-directive", []).directive('leaflet', function ($q, leafl
103103
});
104104

105105
scope.$on('$destroy', function () {
106-
leafletData.getMap().then(function(map) {
107-
map.remove();
108-
});
106+
map.remove();
109107
leafletData.unresolveMap(attrs.id);
110108
});
111109
}

0 commit comments

Comments
 (0)