Skip to content

Commit 57f612a

Browse files
committed
Changed so that attr is removed and watch is checkin select.open
1 parent d137ded commit 57f612a

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

src/uiSelectChoicesDirective.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ uis.directive('uiSelectChoices',
5555

5656

5757
$select.parseRepeatAttr(attrs.repeat, groupByExp, groupFilterExp); //Result ready at $select.parserResult
58-
$select.refreshOnActive = scope.$eval(attrs.refreshOnActive);
5958
$select.disableChoiceExpression = attrs.uiDisableChoice;
6059
$select.onHighlightCallback = attrs.onHighlight;
6160
$select.dropdownPosition = attrs.position ? attrs.position.toLowerCase() : uiSelectConfig.dropdownPosition;
@@ -67,7 +66,7 @@ uis.directive('uiSelectChoices',
6766
scope.$watch('$select.search', function(newValue) {
6867
if(newValue && !$select.open && $select.multiple) $select.activate(false, true);
6968
$select.activeIndex = $select.tagging.isActivated ? -1 : 0;
70-
if ((!attrs.minimumInputLength || $select.search.length >= attrs.minimumInputLength) && (!$select.refreshOnActive || ($select.refreshOnActive && $select.open))) {
69+
if ((!attrs.minimumInputLength || $select.search.length >= attrs.minimumInputLength) && $select.open) {
7170
$select.refresh(attrs.refresh);
7271
} else {
7372
$select.items = [];
@@ -83,10 +82,7 @@ uis.directive('uiSelectChoices',
8382
scope.$watch('$select.open', function(open) {
8483
if (open) {
8584
tElement.attr('role', 'listbox');
86-
if(!angular.isUndefined($select.refreshOnActive)){
87-
//only add a watch when refreshonactive is set.
88-
$select.refresh(attrs.refresh);
89-
}
85+
$select.refresh(attrs.refresh);
9086
} else {
9187
tElement.removeAttr('role');
9288
}

src/uiSelectController.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,7 @@ uis.controller('uiSelectCtrl',
115115
if(!avoidReset) _resetSearchInput();
116116

117117
$scope.$broadcast('uis:activate');
118-
119118
ctrl.open = true;
120-
121119
ctrl.activeIndex = ctrl.activeIndex >= ctrl.items.length ? 0 : ctrl.activeIndex;
122120
// ensure that the index is set to zero for tagging variants
123121
// that where first option is auto-selected
@@ -256,8 +254,6 @@ uis.controller('uiSelectCtrl',
256254
if (ctrl.dropdownPosition === 'auto' || ctrl.dropdownPosition === 'up'){
257255
$scope.calculateDropdownPos();
258256
}
259-
260-
$scope.$broadcast('uis:refresh');
261257
};
262258

263259
// See https://github.com/angular/angular.js/blob/v1.2.15/src/ng/directive/ngRepeat.js#L259

0 commit comments

Comments
 (0)