Skip to content

Commit cb4c13b

Browse files
committed
v1.9.2
2 parents 346ab35 + 75020da commit cb4c13b

File tree

7 files changed

+35
-5
lines changed

7 files changed

+35
-5
lines changed

dist/angular-openlayers-directive.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ angular.module('openlayers-directive', ['ngSanitize']).directive('openlayers', [
9090
view: view
9191
});
9292

93+
scope.$on('$destroy', function() {
94+
olData.resetMap(attrs.id);
95+
});
96+
9397
// If no layer is defined, set the default tileLayer
9498
if (!attrs.customLayers) {
9599
var l = {
@@ -1174,6 +1178,12 @@ angular.module('openlayers-directive').service('olData', ["$log", "$q", function
11741178
return id;
11751179
}
11761180

1181+
this.resetMap = function(scopeId) {
1182+
if (angular.isDefined(maps[scopeId])) {
1183+
delete maps[scopeId];
1184+
}
1185+
};
1186+
11771187
}]);
11781188

11791189
angular.module('openlayers-directive').factory('olHelpers', ["$q", "$log", "$http", function($q, $log, $http) {

dist/angular-openlayers-directive.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-openlayers-directive.min.no-header.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-openlayers-directive.pre.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ angular.module('openlayers-directive', ['ngSanitize']).directive('openlayers', f
9090
view: view
9191
});
9292

93+
scope.$on('$destroy', function() {
94+
olData.resetMap(attrs.id);
95+
});
96+
9397
// If no layer is defined, set the default tileLayer
9498
if (!attrs.customLayers) {
9599
var l = {
@@ -1174,6 +1178,12 @@ angular.module('openlayers-directive').service('olData', function($log, $q) {
11741178
return id;
11751179
}
11761180

1181+
this.resetMap = function(scopeId) {
1182+
if (angular.isDefined(maps[scopeId])) {
1183+
delete maps[scopeId];
1184+
}
1185+
};
1186+
11771187
});
11781188

11791189
angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $http) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,5 @@
6565
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
6666
},
6767
"main": "dist/angular-openlayers-directive",
68-
"version": "1.9.1"
68+
"version": "1.9.2"
6969
}

src/directives/openlayers.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ angular.module('openlayers-directive', ['ngSanitize']).directive('openlayers', f
7575
view: view
7676
});
7777

78+
scope.$on('$destroy', function() {
79+
olData.resetMap(attrs.id);
80+
});
81+
7882
// If no layer is defined, set the default tileLayer
7983
if (!attrs.customLayers) {
8084
var l = {

src/services/olData.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,10 @@ angular.module('openlayers-directive').service('olData', function($log, $q) {
6868
return id;
6969
}
7070

71+
this.resetMap = function(scopeId) {
72+
if (angular.isDefined(maps[scopeId])) {
73+
delete maps[scopeId];
74+
}
75+
};
76+
7177
});

0 commit comments

Comments
 (0)