Jquery 单次选择的ui选择(限制属性不起作用)
这是我的密码。我使用了角度UI选择。它工作得很好。但是现在,下拉列表只选择一次的要求发生了变化。我使用了限制属性,但它不起作用Jquery 单次选择的ui选择(限制属性不起作用),jquery,angularjs,angular-ui,angular-ui-select,Jquery,Angularjs,Angular Ui,Angular Ui Select,这是我的密码。我使用了角度UI选择。它工作得很好。但是现在,下拉列表只选择一次的要求发生了变化。我使用了限制属性,但它不起作用 <span id="oCountriesSpan" ng-class="{'has-error': noCountriesSelected()}"> <ui-select multiple limit="1" ng-model="countryModel.selectedCountries" ng
<span id="oCountriesSpan" ng-class="{'has-error': noCountriesSelected()}">
<ui-select multiple limit="1" ng-model="countryModel.selectedCountries" ng-disabled="isReadOnly" theme="bootstrap">
<ui-select-match placeholder="Select ..." allow-clear="true">{{$item.name}}
</ui-select-match>
<ui-select-choices repeat="country.id as country in countryCodes | filter:$select.search">
{{ country.name }}
</ui-select-choices>
</ui-select>
</span>
{{$item.name}
{{country.name}
限制是在0.13版本之后引入的。我使用的是0.12使用以下代码清除所选选项值
HTML代码
<ui-select-match placeholder=”Enter table…”>
<span>{{$select.selected.description || $select.search}}</span>
<a class=”btn btn-xs btn-link pull-right” ng-click=”clear($event, $select)”><i class=”glyphicon glyphicon-remove”></i></a>
</ui-select-match>
function clear($event, $select){
//stops click event bubbling
$event.stopPropagation();
//to allow empty field, in order to force a selection remove the following line
$select.selected = undefined;
//reset search query
$select.search = undefined;
//focus and open dropdown
$select.activate();
}
是否有其他方法将select限制为仅一个?