0
我使用的是angularjs ui-select, ,正如我在默認情況下在綁定中理解的那樣,我需要的是一個數組的多重下拉列表,問題是我需要具有相同的行爲單選也是。angularjs ui-select綁定到一個數組
$scope.mdf.options = [{ id: 1, name: 'name1' },{ id: 2, name: 'name2' }];
<ui-select ng-model="wrap.piece.original.selections_hash[mdf.id]" close-on-select="false" title="mdf.modifier.display" ng-if="mdf.modifier.max == 1">
<ui-select-match>{{$select.selected.name}}</ui-select-match>
<ui-select-choices repeat="option.id as option in mdf.options">
<span ng-bind="option.name">
</span>
</ui-select-choices>
</ui-select>
因此,當用戶例如選擇NAME2我需要我的模型更新爲[2]而不是2 我怎樣才能做到這一點?我可以使用ui-select嗎?如果不是,我可以用角度選擇來做到嗎?