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

Commit 9242c58

Browse files
refact(select): don't recreate selectedSet on every digest loop
In the case of a "multiple" select, the model value is an array, changes to which don't get picked up by NgModelController as it only looks for object identity change. We were rebuilding the `selectedSet` (a hash map of selected items) from the modelValue on every turn of the digest. This is not needed as we can simply use `$watchCollection` directly on the `$modelValue` instead.
1 parent c286094 commit 9242c58

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ng/directive/select.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
405405

406406
scope.$watchCollection(valuesFn, render);
407407
if ( multiple ) {
408-
scope.$watchCollection(getSelectedSet, render);
408+
scope.$watchCollection(function() { return ctrl.$modelValue; }, render);
409409
}
410410

411411
function getSelectedSet() {

0 commit comments

Comments
 (0)