bentorfs / angular-bootstrap-multiselect

Native angularJS custom form element
http://bentorfs.github.io/angular-bootstrap-multiselect/
MIT License
79 stars 111 forks source link

Selecting one item automatically selects all. #33

Open droiddavid opened 7 years ago

droiddavid commented 7 years ago

<multiselect ng-model="$ctrl.platterFood" options="$ctrl.foodForPlatters" show-search="true" id-prop="id" display-prop="name"></multiselect>

Each time I select a single item from my list, $ctrl.foodForPlatters, which is an array of objects, ALL items become selected. Additionally, on your documentation page, the options is spelled with a capital letter O. Is that intentional? If so, then, what is the options attribute for? Is that where I am supposed to place my data source?

Options: [ "France", "United Kingdom", ... ]

Thanks you for any assistance you can provide.

andyJSexton commented 6 years ago

Hi David, I'm having a similar issue, my model already has some selected items in it (that are present in the options) and my options have the same properties as the model, plus a few more.

leo4llen commented 6 years ago

I had the same issue and the problem with my code was that I was passing an undefined value to the "id-props" attribute. I'm presuming that you are passing an array of mongodb docs to the 'options' attribute. In that case, 'id-prop' should be '_id'. That did the trick for me :)