Skip to content

Commit 327d7ef

Browse files
committed
Only compiling once to prevent ng-repeats from growing on each infoWindow.open()
The original code decorated the infoWindow.open() and would compile() before calling the original infoWindow.open(). This causes ng-repeats to grow with each call. Compiling is needed or else things like ng-click won't work. But a single compile appears to be enough for all functionality to work as expected.
1 parent 9e01b0d commit 327d7ef

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

ui-map.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,9 @@
6969
straight removing things from the dom can mess up angular) */
7070
elm.replaceWith('<div></div>');
7171

72-
//Decorate infoWindow.open to $compile contents before opening
73-
var _open = infoWindow.open;
74-
infoWindow.open = function open(a1, a2, a3, a4, a5, a6) {
75-
$compile(elm.contents())(scope);
76-
_open.call(infoWindow, a1, a2, a3, a4, a5, a6);
77-
};
72+
/* Need to compile once to make sure ng-clicks are hoooked up properly.
73+
Don't compile more than once though, because that messes up ng-repeats! */
74+
$compile(elm.contents())(scope);
7875
}
7976
};
8077
}]);

0 commit comments

Comments
 (0)