Skip to content

Commit

Permalink
v1.9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
www committed Feb 18, 2016
2 parents 346ab35 + 75020da commit cb4c13b
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 5 deletions.
10 changes: 10 additions & 0 deletions dist/angular-openlayers-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ angular.module('openlayers-directive', ['ngSanitize']).directive('openlayers', [
view: view
});

scope.$on('$destroy', function() {
olData.resetMap(attrs.id);
});

// If no layer is defined, set the default tileLayer
if (!attrs.customLayers) {
var l = {
Expand Down Expand Up @@ -1174,6 +1178,12 @@ angular.module('openlayers-directive').service('olData', ["$log", "$q", function
return id;
}

this.resetMap = function(scopeId) {
if (angular.isDefined(maps[scopeId])) {
delete maps[scopeId];
}
};

}]);

angular.module('openlayers-directive').factory('olHelpers', ["$q", "$log", "$http", function($q, $log, $http) {
Expand Down
4 changes: 2 additions & 2 deletions dist/angular-openlayers-directive.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/angular-openlayers-directive.min.no-header.js

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions dist/angular-openlayers-directive.pre.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ angular.module('openlayers-directive', ['ngSanitize']).directive('openlayers', f
view: view
});

scope.$on('$destroy', function() {
olData.resetMap(attrs.id);
});

// If no layer is defined, set the default tileLayer
if (!attrs.customLayers) {
var l = {
Expand Down Expand Up @@ -1174,6 +1178,12 @@ angular.module('openlayers-directive').service('olData', function($log, $q) {
return id;
}

this.resetMap = function(scopeId) {
if (angular.isDefined(maps[scopeId])) {
delete maps[scopeId];
}
};

});

angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $http) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"main": "dist/angular-openlayers-directive",
"version": "1.9.1"
"version": "1.9.2"
}
4 changes: 4 additions & 0 deletions src/directives/openlayers.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ angular.module('openlayers-directive', ['ngSanitize']).directive('openlayers', f
view: view
});

scope.$on('$destroy', function() {
olData.resetMap(attrs.id);
});

// If no layer is defined, set the default tileLayer
if (!attrs.customLayers) {
var l = {
Expand Down
6 changes: 6 additions & 0 deletions src/services/olData.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,10 @@ angular.module('openlayers-directive').service('olData', function($log, $q) {
return id;
}

this.resetMap = function(scopeId) {
if (angular.isDefined(maps[scopeId])) {
delete maps[scopeId];
}
};

});

0 comments on commit cb4c13b

Please sign in to comment.