Skip to content

Commit 478796c

Browse files
Benoit de La ForestBenoit de La Forest
Benoit de La Forest
authored and
Benoit de La Forest
committed
Reset activeIndex at the same time we reset search input (instead of when we close popup)
1 parent d935722 commit 478796c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: src/select.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ angular.module('ui.select', [])
129129
function _resetSearchInput() {
130130
if (ctrl.resetSearchInput) {
131131
ctrl.search = EMPTY_SEARCH;
132+
//reset activeIndex
133+
if (ctrl.selected && ctrl.items.length) {
134+
ctrl.activeIndex = ctrl.items.indexOf(ctrl.selected);
135+
}
132136
}
133137
}
134138

@@ -200,10 +204,6 @@ angular.module('ui.select', [])
200204
// Closes the dropdown
201205
ctrl.close = function() {
202206
if (ctrl.open) {
203-
//reset activeIndex
204-
if (ctrl.selected && ctrl.items.length) {
205-
ctrl.activeIndex = ctrl.items.indexOf(ctrl.selected);
206-
}
207207
_resetSearchInput();
208208
ctrl.open = false;
209209
}

0 commit comments

Comments
 (0)