Reputation: 21901
Im using angular-ui select2 plugin I cant find any solution for clear the selected input. how to clear the selected input ? thanks.
<http://plnkr.co/edit/a3KlK8dKH3wwiiksDSn2?p=preview>
I want somethig like this.
Upvotes: 2
Views: 3356
Reputation: 752
Here are two options:
1 - You could use standart attribute allow-clear="true"
<ui-select ...>
<ui-select-match allow-clear="true" ...>{{$select.selected.name}}</ui-select-match>
...
</ui-select>
OR
2 - You could add a button
<ui-select-match placeholder="Select or search a country in the list...">
<span>...</span>
<button class="clear" ng-click="clear($event)">X</button>
</ui-select-match>
$scope.clear = function($event) {
$event.stopPropagation();
$scope.country.selected = undefined;
};
Upvotes: 1