Angular ui-选择多个清理ng模型值

lui*_*aco 19 html javascript frontend angularjs ui-select

我正在尝试使用ui-select,组件正在清理我的数组.

例:

{{ 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>
Run Code Online (Sandbox Code Playgroud)

屏幕上的变量"vm.staff_hotels"值为[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>
Run Code Online (Sandbox Code Playgroud)

但是,如果我在ng-model中使用变量,我的值会更改为[null,null].

lui*_*aco 10

我只需要更新我的ui-select版本.

我曾经使用版本0.10.0

我更新到版本0.11.2

只是一个bug!

  • 六要放弃50才能找到答案.很高兴你得到了它 (2认同)