私はui-select要素を使ってAngularで小さなプログラムを書いた。ここではhtmlコードは次のとおりです。ui-selectでデフォルト値を角度で設定する方法は?
<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
問題は、私がしたいということです「すべて」をデフォルト値として(選択がない場合)、私のプランナーのデフォルト値は「 - ---- ***」
このデフォルト値を設定してもらえますか? ありがとう!