请查看以下插件:http://plnkr.co/edit/fc9XcyyYGtAk0aGVV35t?p = preview
<ui-select ng-model="fm.countryCode" id="countryCode">
<ui-select-match placeholder="Select a country...">{{$select.selected.label}}</ui-select-match>
<ui-select-choices repeat="item in countries | filter: $select.search" value="{{$select.selected.value}}">
<div ng-bind-html="item.label | highlight: $select.search"></div>
<small ng-bind-html="item.value | highlight: $select.search"></small>
</ui-select-choices>
</ui-select>
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用ui-select将fm.countryCode设置为所选项的值.目前它只是将fm.countryCode设置为整个国家/地区项目.例如,如果我选择阿富汗,fm.countryCode将设置为{"value":"AF","label":"Afghanistan"}.我想要的是"AF".
我是否必须设置$ watch来实现这一目标,还是有更优雅的解决方案?
我个人想不到一个,但我真诚地希望听到任何认为Adobe ColdFusion仍然物有所值的人.