|
180 | 180 | ctrl.selected = undefined;
|
181 | 181 | ctrl.open = false;
|
182 | 182 | ctrl.focus = false;
|
| 183 | + ctrl.refreshOnActive = undefined; |
| 184 | + ctrl.refreshIsActive = undefined; |
183 | 185 | ctrl.focusser = undefined; //Reference to input element used to handle focus events
|
184 | 186 | ctrl.disabled = undefined; // Initialized inside uiSelect directive link function
|
185 | 187 | ctrl.searchEnabled = undefined; // Initialized inside uiSelect directive link function
|
|
224 | 226 |
|
225 | 227 | ctrl.activeIndex = ctrl.activeIndex >= ctrl.items.length ? 0 : ctrl.activeIndex;
|
226 | 228 |
|
| 229 | + ctrl.refreshIsActive = true; |
| 230 | + |
227 | 231 | // ensure that the index is set to zero for tagging variants
|
228 | 232 | // that where first option is auto-selected
|
229 | 233 | if ( ctrl.activeIndex === -1 && ctrl.taggingLabel !== false ) {
|
|
1284 | 1288 | $select.disableChoiceExpression = attrs.uiDisableChoice;
|
1285 | 1289 | $select.onHighlightCallback = attrs.onHighlight;
|
1286 | 1290 |
|
| 1291 | + $select.refreshOnActive = attrs.refreshOnActive; |
| 1292 | + |
1287 | 1293 | if(groupByExp) {
|
1288 | 1294 | var groups = element.querySelectorAll('.ui-select-choices-group');
|
1289 | 1295 | if (groups.length !== 1) throw uiSelectMinErr('rows', "Expected 1 .ui-select-choices-group but got '{0}'.", groups.length);
|
|
1309 | 1315 | scope.$watch('$select.search', function(newValue) {
|
1310 | 1316 | if(newValue && !$select.open && $select.multiple) $select.activate(false, true);
|
1311 | 1317 | $select.activeIndex = $select.tagging.isActivated ? -1 : 0;
|
1312 |
| - $select.refresh(attrs.refresh); |
| 1318 | + if(angular.isUndefined($select.refreshOnActive) || ($select.refreshOnActive && $select.refreshIsActive)) { |
| 1319 | + $select.refresh(attrs.refresh); |
| 1320 | + } |
| 1321 | + }); |
| 1322 | + |
| 1323 | + scope.$watch('$select.refreshIsActive', function(value){ |
| 1324 | + if(angular.isUndefined(value)){ |
| 1325 | + $select.refresh(attrs.refresh); |
| 1326 | + } |
1313 | 1327 | });
|
1314 | 1328 |
|
1315 | 1329 | attrs.$observe('refreshDelay', function() {
|
|
0 commit comments