Angular ui-select multiple clean ng-model value
Asked Answered
B

1

18

I am trying to use the ui-select and the component is cleaning my array.

Example:

{{ vm.staff_hotels }}
<ui-select multiple ng-model="x" theme="bootstrap">
    <ui-select-match placeholder="Not selected">{{$item.name}}</ui-select-match>
    <ui-select-choices repeat="hotel.id as hotel in vm.hotels | filter: {active: true} | filter: $select.search">
        <div ng-bind-html="hotel.name | highlight: $select.search"></div>
    </ui-select-choices>
</ui-select>

My variable "vm.staff_hotels" value on screen is [1,2].

{{ vm.staff_hotels }}
<ui-select multiple ng-model="vm.staff_hotels" theme="bootstrap">
    <ui-select-match placeholder="Not selected">{{$item.name}}</ui-select-match>
    <ui-select-choices repeat="hotel.id as hotel in vm.hotels | filter: {active: true} | filter: $select.search">
        <div ng-bind-html="hotel.name | highlight: $select.search"></div>
    </ui-select-choices>
</ui-select>

but, if I use the variable in ng-model my value change to [null,null].

Blatt answered 20/5, 2015 at 11:31 Comment(3)
Are there hotels with id 1 and 2?Injured
can you please create a jsfiddle for your issue.Lonnalonnard
that is the problem, I have the same code working well in another controller, so, I need to know why this CAN happening, because it is not a default behaviour.Blatt
B
10

I just need to update the version of my ui-select.

I used to use version 0.10.0

I updated to version 0.11.2

Just a bug!

Blatt answered 23/5, 2015 at 1:6 Comment(1)
Six to give up 50 to find that out. Glad you got it backTiddlywinks

© 2022 - 2024 — McMap. All rights reserved.