1
我想不通爲什麼我不能一個目標是NG-模型綁定在choosen指令綁定NG-型號,以選擇
我的繼承人HTML內容的代碼:
<select class="form-control" required
multiple
ng-model="selectedItems"
ng-options="r.id as r.name for r in availableItems"
chosen>
</select>
該JSON:
$scope.selectedItems= [
{
"id": 1,
"name": "Selected 1",
"description": "Nulla adi architecto et",
},
{
"id": 2,
"name": "Selected 2",
"description": "test",
}
]
$scope.availableItems= [
{
"id": 1,
"name": "Available 1",
"description": "Nulla adi architecto et",
},
{
"id": 2,
"name": "Available 2",
"description": "test",
}
]
但是我能夠顯示在選擇下拉可用的項目,但我的要求: 要choosen的輸入框中默認顯示選定的項目。
您可以加入這個問題的的jsfiddle?我認爲這有助於將問題形象化。 – benjipelletier