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

Commit 926f462

Browse files
author
Patrick Housley
committed
perf(uiSelectCtrl): moving activate events out of $timeout
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.
1 parent 6444d6b commit 926f462

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/uiSelectController.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,14 @@ uis.controller('uiSelectCtrl',
128128
var animateHandler = function(elem, phase) {
129129
if (phase === 'start' && ctrl.items.length === 0) {
130130
// Only focus input after the animation has finished
131+
ctrl.$animate.off('removeClass', searchInput[0], animateHandler);
131132
$timeout(function () {
132-
ctrl.$animate.off('removeClass', searchInput[0], animateHandler);
133133
ctrl.focusSearchInput(initSearchValue);
134134
});
135135
} else if (phase === 'close') {
136136
// Only focus input after the animation has finished
137+
ctrl.$animate.off('enter', container[0], animateHandler);
137138
$timeout(function () {
138-
ctrl.$animate.off('enter', container[0], animateHandler);
139139
ctrl.focusSearchInput(initSearchValue);
140140
});
141141
}

0 commit comments

Comments
 (0)