Skip to content

Commit d935722

Browse files
Benoit de La ForestBenoit de La Forest
Benoit de La Forest
authored and
Benoit de La Forest
committed
Make select item active on popup close to have it highlighted the next time we open the popup
1 parent 80d90da commit d935722

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/select.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ angular.module('ui.select', [])
200200
// Closes the dropdown
201201
ctrl.close = function() {
202202
if (ctrl.open) {
203+
//reset activeIndex
204+
if (ctrl.selected && ctrl.items.length) {
205+
ctrl.activeIndex = ctrl.items.indexOf(ctrl.selected);
206+
}
203207
_resetSearchInput();
204208
ctrl.open = false;
205209
}
@@ -284,7 +288,7 @@ angular.module('ui.select', [])
284288
}])
285289

286290
.directive('uiSelect',
287-
['$document', 'uiSelectConfig', 'uiSelectMinErr',
291+
['$document', 'uiSelectConfig', 'uiSelectMinErr',
288292
function($document, uiSelectConfig, uiSelectMinErr) {
289293

290294
return {

0 commit comments

Comments
 (0)