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

Commit

Permalink
fix(Typeahead): Fix for memory-leak in typeahead
Browse files Browse the repository at this point in the history
Remove template element in order to prevent memory leak when directive is instantiated/destroyed

Move element removal to $destroy block to be safe
  • Loading branch information
Peter af Geijerstam authored and wesleycho committed Mar 16, 2015
1 parent 87a3607 commit b5a80c0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/typeahead/typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,12 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap
if (appendToBody) {
$popup.remove();
}
// Prevent jQuery cache memory leak
popUpEl.remove();
});

var $popup = $compile(popUpEl)(scope);

if (appendToBody) {
$document.find('body').append($popup);
} else {
Expand Down

0 comments on commit b5a80c0

Please sign in to comment.