ng2-select icon indicating copy to clipboard operation
ng2-select copied to clipboard

active is not updated when items change

Open AdaAdamczak opened this issue 7 years ago • 5 comments

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

AdaAdamczak avatar Jun 28 '17 08:06 AdaAdamczak

I have the same issue.

FelipeCorso avatar Jul 17 '17 18:07 FelipeCorso

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

dilotec-2015 avatar Aug 30 '17 11:08 dilotec-2015

@dilotec-2015 are U sure this works?

kotmatpockuh avatar Sep 05 '17 08:09 kotmatpockuh

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

zszep avatar Sep 27 '17 10:09 zszep

so how about in FormControlName?

DoanVanThuong avatar Nov 29 '19 04:11 DoanVanThuong