我正在尝试使用 angular-ui-select 指令为我的选择添加可搜索性。当我使用 angular-ui-select 时,模型值变成了整个时区,而不仅仅是 id。
这是代码:
<!-- select with ngOptions doing what I want -->
<select data-ng-model="clock.time_zone_id" data-ng-options="timeZone.id as timeZone.name for timeZone in timeZones"></select>
<!-- my best try with angular-ui-select -->
<ui-select data-ng-model="clock.time_zone_id" theme="selectize">
<ui-select-match>{{$select.selected.name}}</ui-select-match>
<ui-select-choices repeat="timeZone in timeZones | filter: $select.search">
<span ng-bind-html="timeZone.name | highlight: $select.search"></span>
</ui-select-choices>
</ui-select>
我错过了什么?我会很感激任何帮助!