ui-select
does not permit the insertion of duplicate values in a select list item. However, I have a scenario where a user needs to input a value multiple times that will not be selected from the dropdown list.
Is there a way to accomplish this using the ui-select
directive?
<ui-select multiple tagging tagging-label="(custom 'new' label)" ng-model="ctrl.multipleDemo.colors" theme="bootstrap" sortable="true" ng-disabled="ctrl.disabled" style="width: 300px;" title="Choose a color">
<ui-select-match placeholder="Select colors...">{{$item}}</ui-select-match>
<ui-select-choices repeat="color in ctrl.availableColors | filter:$select.search track by $index">
{{color}}
</ui-select-choices>
</ui-select>
You can access a sample plunk http://plnkr.co/edit/s407ooeoeFh2dH9DynZy?p=preview here
In this ui select, users may manually enter values like 'a'. Once 'a' is entered, it cannot be input again due to the restriction on duplicates set by ng-repeat. Even when attempting to use track by $index, duplicating the same value is not permitted.