Skip to content

Commit

Permalink
Add map.remove on scope $destroy
Browse files Browse the repository at this point in the history
  • Loading branch information
marekkalnik committed Sep 2, 2014
1 parent 5dd2a01 commit 380b039
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/directives/leaflet.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ angular.module("leaflet-directive", []).directive('leaflet', function ($q, leafl
});

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

0 comments on commit 380b039

Please sign in to comment.