Skip to content
This repository was archived by the owner on Nov 30, 2018. It is now read-only.

Commit 391fa0d

Browse files
committed
add condition for last layer index
1 parent 9b5fdae commit 391fa0d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

dist/angular-google-maps.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4928,7 +4928,7 @@ Original idea from: http://stackoverflow.com/questions/22758950/google-map-drawi
49284928
if (angular.isDefined(this.scope.index)) {
49294929
found = false;
49304930
if (this.gMap.overlayMapTypes.getLength()) {
4931-
return this.gMap.overlayMapTypes.forEach((function(_this) {
4931+
this.gMap.overlayMapTypes.forEach((function(_this) {
49324932
return function(mapType, index) {
49334933
var layerIndex;
49344934
if (!found) {
@@ -4940,6 +4940,9 @@ Original idea from: http://stackoverflow.com/questions/22758950/google-map-drawi
49404940
}
49414941
};
49424942
})(this));
4943+
if (!found) {
4944+
return this.gMap.overlayMapTypes.push(this.mapType);
4945+
}
49434946
} else {
49444947
return this.gMap.overlayMapTypes.push(this.mapType);
49454948
}

src/coffee/directives/api/models/parent/map-type-parent-model.coffee

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ angular.module('uiGmapgoogle-maps.directives.api.models.parent')
9999
found = true
100100
@gMap.overlayMapTypes.insertAt index, @mapType
101101
return
102+
103+
# if still not found, it just means that no layer has been found with
104+
# a higher (or missing) index, so just added to the end
105+
if !found
106+
@gMap.overlayMapTypes.push @mapType
102107
else
103108
@gMap.overlayMapTypes.push @mapType
104109
else

0 commit comments

Comments
 (0)