我试图添加搜索到我的选择与角-ui-选择指令。当我使用角-ui-选择时,模型值会变成整个时区,而不仅仅是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>我遗漏了什么?我很感谢你的帮助!
发布于 2015-03-30 19:04:20
这应该是可行的:
<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.id as timeZone in timeZones | filter: $select.search">
<span ng-bind-html="timeZone.name | highlight: $select.search"></span>
</ui-select-choices>
</ui-select>https://stackoverflow.com/questions/29351837
复制相似问题