2017-01-16 14 views
1

我在使用角度選擇多個方面存在問題。我正在使用庫bootstrap-select.js,我必須在ng選項中對值進行賦值,但是當我編寫多個屬性時,它將中止選擇。使用bootstrap-select.js和ng-options選擇多個角度

<select 
    ng-show="vm.showAuidit" 
    id="select_audits" 
    class="form-control selectpicker" 
    tabindex="-1" 
    ng-model='vm.type' 
    ng-change="vm.selectType()" 
    ng-init="vm.selectType()" 
    ng-selected="type.value === vm.type" 
    ng-options='type.value as type.name for type in vm.types' 
    ng-disabled="vm.selectEnable()" 
    multiple title=""> 
</select> 

有沒有人知道如何使用ng-options實現一個好的多選工作?

謝謝!

+0

'NG-options'使用'vm.types'而NG-模型有'vm.type'。這可能會導致問題 – Sangharsh

+0

vm.type僅適用於ng選定的情況。如果我把代碼沒有多個關鍵字它的工作原理,如果我把代碼沒有ng-options和qith 它的作品,但我需要在這種情況下使用ng選項。 – Noark

回答

0

我解決了這個改變爲多選庫angularjs-下拉-multiselect.min.js

<select 
    ng-show="vm.showAuidit" 
    id="select_localizaciones" 
    class="form-control" 
    tabindex="-1" 
    ng-model='vm.localizaciones' 
    ng-change="vm.selectType()" 
    ng-init="vm.selectType()" 
    ng-options='localizacion.value as localizacion.name for localizacion in vm.localizaciones' 
    ng-disabled="vm.selectEnable()" 
    required> 
</select> 

爲DOC:angularjs-dropdown-multiselect