【发布时间】:2016-12-01 18:18:11
【问题描述】:
我使用 ui-select 元素在 Angular 中编写了一个小程序。这是html代码:
<ui-select ng-model="test.selectedContract">
<ui-select-match >
{{$select.selected.name}} - {{$select.selected.value}} ---- {{$select.selected.id.id}} *** {{$select.selected.policy.info.name }}
</ui-select-match>
<ui-select-choices group-by="groupByLetter"
repeat="contract in (contracts |
orSearchFilter: {id.id: $select.search, policy.info.name : $select.search} |
orderBy: 'name') track by contract.name">
{{contract.name}} - {{contract.value}} ---- {{contract.id.id}} *** {{contract.policy.info.name }}
</ui-select-choices>
</ui-select>
这是我的合同对象的结构:
$scope.contracts = [{
name: "contract1.00",
value: 10,
id: {
id: 8000,
code: 2
},
policy: {
info: {
name: "test1",
country: "test"
}
}
}, //other contract objects
最后是我的 plunker 代码:http://plnkr.co/edit/PigjGCj5ukxscJC7Wl97?p=preview
问题是我想将 "All" 显示为默认值(如果没有选择),而我的 plunker 中的默认值是:“ - ---- *** "
你能帮我设置这个默认值吗? 谢谢!
【问题讨论】: