Skip to content
This repository has been archived by the owner on Sep 20, 2019. It is now read-only.

Don't delete all map defaults on one map destroy #322

Open
wants to merge 1 commit into
base: 1.X
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/directives/leaflet.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ angular.module('ui-leaflet', ['nemLogging']).directive('leaflet',
});

scope.$on('$destroy', function () {
leafletMapDefaults.reset();
leafletMapDefaults.reset(attrs.id);
map.remove();
leafletData.unresolveMap(attrs.id);
});
Expand Down
5 changes: 3 additions & 2 deletions src/services/leafletMapDefaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ angular.module('ui-leaflet').factory('leafletMapDefaults', function ($q, leaflet

// Get the _defaults dictionary, and override the properties defined by the user
return {
reset: function () {
defaults = {};
reset: function (scopeId) {
var mapId = obtainEffectiveMapId(defaults, scopeId);
delete defaults[mapId];
},
getDefaults: function (scopeId) {
var mapId = obtainEffectiveMapId(defaults, scopeId);
Expand Down