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.
This commit is contained in:
Igor Minar 2011-08-20 22:32:55 -07:00
parent ac6e1306ec
commit 6aa04b1db4

View file

@ -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