Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix(ng:options): remove memory leak caused by scope.
Browse files Browse the repository at this point in the history
$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.
  • Loading branch information
IgorMinar committed Aug 21, 2011
1 parent ac6e130 commit 6aa04b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6aa04b1

Please sign in to comment.