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

Commit 6aa04b1

Browse files
committed
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.
1 parent ac6e130 commit 6aa04b1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/widgets.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ angularWidget('select', function(element){
733733
var optionGroup,
734734
collection = valuesFn(scope) || [],
735735
key = selectElement.val(),
736-
tempScope = scope.$new(),
736+
tempScope = inherit(scope),
737737
value, optionElement, index, groupIndex, length, groupLength;
738738

739739
try {
@@ -791,7 +791,7 @@ angularWidget('select', function(element){
791791
fragment,
792792
groupIndex, index,
793793
optionElement,
794-
optionScope = scope.$new(),
794+
optionScope = inherit(scope),
795795
modelValue = model.get(),
796796
selected,
797797
selectedSet = false, // nothing is selected yet

0 commit comments

Comments
 (0)