Skip to content
This repository has been archived by the owner on Oct 2, 2019. It is now read-only.

Commit

Permalink
perf(uiSelectCtrl): moving activate events out of $timeout
Browse files Browse the repository at this point in the history
Moved the removal of activate events out of the $timeout. This removes additional unneccessary calls to the event handler once the $timeout has been initiated.
  • Loading branch information
patrickhousley committed Mar 23, 2016
1 parent 6444d6b commit 926f462
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/uiSelectController.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ uis.controller('uiSelectCtrl',
var animateHandler = function(elem, phase) {
if (phase === 'start' && ctrl.items.length === 0) {
// Only focus input after the animation has finished
ctrl.$animate.off('removeClass', searchInput[0], animateHandler);
$timeout(function () {
ctrl.$animate.off('removeClass', searchInput[0], animateHandler);
ctrl.focusSearchInput(initSearchValue);
});
} else if (phase === 'close') {
// Only focus input after the animation has finished
ctrl.$animate.off('enter', container[0], animateHandler);
$timeout(function () {
ctrl.$animate.off('enter', container[0], animateHandler);
ctrl.focusSearchInput(initSearchValue);
});
}
Expand Down

0 comments on commit 926f462

Please sign in to comment.