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

Commit b5a80c0

Browse files
Peter af Geijerstamwesleycho
authored andcommitted
fix(Typeahead): Fix for memory-leak in typeahead
Remove template element in order to prevent memory leak when directive is instantiated/destroyed Move element removal to $destroy block to be safe
1 parent 87a3607 commit b5a80c0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/typeahead/typeahead.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,12 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap
321321
if (appendToBody) {
322322
$popup.remove();
323323
}
324+
// Prevent jQuery cache memory leak
325+
popUpEl.remove();
324326
});
325327

326328
var $popup = $compile(popUpEl)(scope);
329+
327330
if (appendToBody) {
328331
$document.find('body').append($popup);
329332
} else {

0 commit comments

Comments
 (0)