Skip to content
This repository was archived by the owner on May 25, 2019. It is now read-only.

Commit e69a112

Browse files
committed
check for google object before binding events
inside an ng-repeat, when the collection is empty the watch still gets triggered, but with undefined as value. We shouldn't bind events in this case.
1 parent 6331ed6 commit e69a112

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

ui-map.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@
9292
restrict: 'A',
9393
link: function (scope, elm, attrs) {
9494
scope.$watch(attrs[directiveName], function (newObject) {
95-
bindMapEvents(scope, events, newObject, elm);
95+
if (newObject) {
96+
bindMapEvents(scope, events, newObject, elm);
97+
}
9698
});
9799
}
98100
};
@@ -122,4 +124,4 @@
122124
mapOverlayDirective('uiMapGroundOverlay',
123125
'click dblclick');
124126

125-
})();
127+
})();

0 commit comments

Comments
 (0)