valor-software / ng2-select

Angular based replacement for select boxes
http://valor-software.github.io/ng2-select/
MIT License
675 stars 587 forks source link

active is not updated when items change #843

Open AdaAdamczak opened 7 years ago

AdaAdamczak commented 7 years ago

When I update items programmatically, the 'active' remains unchanged. Shouldn't 'active' be cleared on items input?

FelipeCorso commented 7 years ago

I have the same issue.

dilotec-2015 commented 6 years ago

if you add or delete an array item angular seems not notice the change because the reference to this array has not changed.

if you do something like this: this.activeItems.push({id: '1', text: 'something'}); this.activeItems= JSON.parse(JSON.stringify(this.activeItems)); then the active items will be updated

the same about updating the items list

kotmatpockuh commented 6 years ago

@dilotec-2015 are U sure this works?

zszep commented 6 years ago

@kotmatpockuh It works. Banged my head with this for whole two hours. You can just reinitialize te array with this.activeItems = [].

DoanVanThuong commented 4 years ago

so how about in FormControlName?