Skip to content

Commit de1ae36

Browse files
author
Wylie Conlon
committed
Catch error in case $destroy is called twice
This error can happen when using ui-router, as ui-router will manage your application lifecycle incorrectly. See this issue for more information: angular-ui/ui-router#881
1 parent c33a714 commit de1ae36

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

dist/angular-leaflet-directive.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,11 @@ angular.module("leaflet-directive", []).directive('leaflet', ["$q", "leafletData
138138
});
139139

140140
scope.$on('$destroy', function () {
141-
map.remove();
142-
leafletData.unresolveMap(attrs.id);
141+
try {
142+
map.remove();
143+
leafletData.unresolveMap(attrs.id);
144+
} catch (e) {
145+
}
143146
});
144147

145148
//Handle request to invalidate the map size

0 commit comments

Comments
 (0)