Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit e16bb85

Browse files
Add minimumInputLength option
Shoul be added as "minimum-input-length" on ui-select-choices directive
1 parent 4467b82 commit e16bb85

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/uiSelectChoicesDirective.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ uis.directive('uiSelectChoices',
5454
scope.$watch('$select.search', function(newValue) {
5555
if(newValue && !$select.open && $select.multiple) $select.activate(false, true);
5656
$select.activeIndex = $select.tagging.isActivated ? -1 : 0;
57-
$select.refresh(attrs.refresh);
57+
if (!attrs.minimumInputLength || $select.search.length >= attrs.minimumInputLength) {
58+
$select.refresh(attrs.refresh);
59+
} else {
60+
$select.items = [];
61+
}
5862
});
5963

6064
attrs.$observe('refreshDelay', function() {

0 commit comments

Comments
 (0)