1

I´m having problems with a select multiple in angular. I´m using the library bootstrap-select.js and I have to assign the values in ng-options, but when I write the multiple attribute it brokes the select.

<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>

Does anybody knows how to implement a good select multipleworking with ng-options?

thanks!

2
  • ng-options use vm.types whereas ng-model has vm.type. This might be causing problem Commented Jan 16, 2017 at 12:33
  • vm.type is for ng-selected only in this case. If i put the code without multiple keyword it works and if I put the code without ng-options and qith <option></option> it works, but I need to use ng-options in this case. Commented Jan 16, 2017 at 13:26

1 Answer 1

1

I solved this changing the multi select library for angularjs-dropdown-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>

for doc: angularjs-dropdown-multiselect

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.