Skip to content
This repository has been archived by the owner on May 21, 2021. It is now read-only.

Commit

Permalink
feat(performance): improve performance by not watching options deeply
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Burgmer committed Apr 9, 2014
1 parent 0cb34de commit 45428c6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/w11k-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ angular.module('w11k.select').directive('w11kSelect', [

function filterOptions() {
if (hasBeenOpened) {
// false as third parameter: use contains to compare
optionsFiltered = filter(options, scope.filter.values, false);
scope.optionsToShow = limitTo(optionsFiltered, initialLimitTo);
}
Expand All @@ -274,9 +275,9 @@ angular.module('w11k.select').directive('w11kSelect', [
}
});

scope.$watch('filter.values', function () {
scope.$watch('filter.values.label', function () {
filterOptions();
}, true);
});

scope.clearFilter = function () {
scope.filter.values = {};
Expand Down Expand Up @@ -401,8 +402,7 @@ angular.module('w11k.select').directive('w11kSelect', [
if (angular.isDefined(newVal)) {
updateOptions();
}
},
true
}
);

// called on click to a checkbox of an option
Expand Down

0 comments on commit 45428c6

Please sign in to comment.