|
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 ) {
|
|
1238 | 1242 | $select.disableChoiceExpression = attrs.uiDisableChoice;
|
1239 | 1243 | $select.onHighlightCallback = attrs.onHighlight;
|
1240 | 1244 |
|
| 1245 | + $select.refreshOnActive = attrs.refreshOnActive; |
| 1246 | + |
1241 | 1247 | if(groupByExp) {
|
1242 | 1248 | var groups = element.querySelectorAll('.ui-select-choices-group');
|
1243 | 1249 | if (groups.length !== 1) throw uiSelectMinErr('rows', "Expected 1 .ui-select-choices-group but got '{0}'.", groups.length);
|
|
1263 | 1269 | scope.$watch('$select.search', function(newValue) {
|
1264 | 1270 | if(newValue && !$select.open && $select.multiple) $select.activate(false, true);
|
1265 | 1271 | $select.activeIndex = $select.tagging.isActivated ? -1 : 0;
|
1266 |
| - $select.refresh(attrs.refresh); |
| 1272 | + if(angular.isUndefined($select.refreshOnActive) || ($select.refreshOnActive && $select.refreshIsActive)) { |
| 1273 | + $select.refresh(attrs.refresh); |
| 1274 | + } |
| 1275 | + }); |
| 1276 | + |
| 1277 | + scope.$watch('$select.refreshIsActive', function(value){ |
| 1278 | + if(angular.isUndefined(value)){ |
| 1279 | + $select.refresh(attrs.refresh); |
| 1280 | + } |
1267 | 1281 | });
|
1268 | 1282 |
|
1269 | 1283 | attrs.$observe('refreshDelay', function() {
|
|
1329 | 1343 | };
|
1330 | 1344 | });
|
1331 | 1345 | }());
|
1332 |
| - |
|
0 commit comments