From 6aa04b1db48853340d720e0a1a3e325ac523a06f Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Sat, 20 Aug 2011 22:32:55 -0700 Subject: [PATCH] fix(ng:options): remove memory leak caused by scope. $new can't be used for creation of temporary scopes because it registers an onEval listener that doesn't go away and keeps the scope around, we must use inherit(scope) instead to avoid this issue. The issue does not apply to the master branch with the new scope which has a scope descructor to clean up this mess. --- src/widgets.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets.js b/src/widgets.js index 4a2820c95132..4bd7654f686d 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -733,7 +733,7 @@ angularWidget('select', function(element){ var optionGroup, collection = valuesFn(scope) || [], key = selectElement.val(), - tempScope = scope.$new(), + tempScope = inherit(scope), value, optionElement, index, groupIndex, length, groupLength; try { @@ -791,7 +791,7 @@ angularWidget('select', function(element){ fragment, groupIndex, index, optionElement, - optionScope = scope.$new(), + optionScope = inherit(scope), modelValue = model.get(), selected, selectedSet = false, // nothing is selected yet