Angularjs ui选择选择对象(哈希表)而不是对象数组
我有以下Angularjs ui选择选择对象(哈希表)而不是对象数组,angularjs,hashtable,ui-select,angular-ui-select,Angularjs,Hashtable,Ui Select,Angular Ui Select,我有以下ui选择工作: <ui-select ng-model="vm.example" name="example"> <ui-select-match placeholder="Select...">{{$select.selected.key}}</ui-select-match> <ui-select-choices repeat="x in vm.examples | filter: $select.search">
ui选择
工作:
<ui-select ng-model="vm.example" name="example">
<ui-select-match placeholder="Select...">{{$select.selected.key}}</ui-select-match>
<ui-select-choices repeat="x in vm.examples | filter: $select.search">
<div ng-bind-html="x.key | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
但是,我希望select的“数据源”是一个对象文本,如下所示
vm.examples = {
a: 1,
b: 2,
c: 3
}
我试了好几次都没能成功,有什么想法吗?如果由于ui而无法执行,请选择当前实现。。。有人知道原因吗
提前谢谢 我终于在上的ui选择wiki中找到了答案
{{$select.selected.value.name}
电子邮件:{{person.value.email}
年龄:
我终于在用户界面上找到了答案,选择
维基
{{$select.selected.value.name}
电子邮件:{{person.value.email}
年龄:
vm.examples = {
a: 1,
b: 2,
c: 3
}
<ui-select ng-model="person.selectedValue" title="Choose a person">
<ui-select-match placeholder="Select a person in the list or search his name/age...">{{$select.selected.value.name}}</ui-select-match>
<ui-select-choices repeat="person.value as (key, person) in peopleObj | filter: {'value':$select.search}">
<div ng-bind-html="person.value.name | highlight: $select.search"></div>
<small>
email: {{person.value.email}}
age: <span ng-bind-html="''+person.value.age | highlight: $select.search"></span>
</small>
</ui-select-choices>
</ui-select>