admin管理员组

文章数量:1334189

I am trying to use the ui-select and the ponent 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].

I am trying to use the ui-select and the ponent 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].

Share edited May 20, 2015 at 12:55 luigibertaco asked May 20, 2015 at 11:31 luigibertacoluigibertaco 1,1425 silver badges23 bronze badges 3
  • Are there hotels with id 1 and 2? – dting Commented May 22, 2015 at 15:00
  • can you please create a jsfiddle for your issue. – Waseem Bepari Commented May 22, 2015 at 15:09
  • 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. – luigibertaco Commented May 22, 2015 at 23:30
Add a ment  | 

1 Answer 1

Reset to default 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!

本文标签: javascriptAngular uiselect multiple clean ngmodel valueStack Overflow