【发布时间】:2016-09-25 05:20:47
【问题描述】:
我正在使用 ui-select 从服务器获取数据并将其填充到下拉列表中(搜索和选择)。我为你创建了一个plunker。
<ui-select ng-model="country.selected" theme="selectize" ng-disabled="disabled" style="width: 300px;">
<ui-select-match placeholder="Select or search a country in the list...">{{$select.selected.name}}</ui-select-match>
<ui-select-choices repeat="country in countries | filter: $select.search">
<span ng-bind-html="country.name | highlight: $select.search"></span>
<small ng-bind-html="country.code | highlight: $select.search"></small>
</ui-select-choices>
</ui-select>
一旦我从选择器中选择了任何值,我就可以进一步更改。但无法删除。我怎样才能做到这一点?
【问题讨论】:
-
'无法删除' 删除什么?选自
select?还是从显示的选中项? -
@devqon 从选择中选择
-
我想像没有选择任何选项一样退缩
-
然后重置
country.selected?<button ng-click="country.selected = null">Remove</button>
标签: javascript angularjs ui-select