NbSelect Multiple not updating changes to selected items on array changes such as push or splice
- 主要言語
- TypeScript
- スター
- 8.1k
- フォーク
- 1.5k
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
### Issue type
**I'm submitting a ...** (check one with "x")
* [X] bug report
* [ ] feature request
### Issue description
**Current behavior:**
When using an nb-select component with the [(selected)] two-way binding, the selected items are not updated when making array changes such as push or splice
**Expected behavior:**
The list of selected items within the control should be updated when calling push or splice on the array bound to selected
**Steps to reproduce:**
See stackblitz: https://stackblitz.com/edit/github-jtckgk?file=src%2Fapp%2Fhome%2Fhome.component.ts
**Related code:**
This will not work as expected:
```
selectedItems = [1, 2];
items = [1, 2, 3, 4];
pushItem(item) {
this.selectedItems.push(item);
}
```
Adding the following line after the array operation will work around the issue:
```
this.selectedItems = this.selectedItems.slice();
```
### Other information:
**Angular, Nebular**
```
"@angular/core": "11.2.12",
"@nebular/theme": "7.0.0",
```
コントリビューションガイド
評価
この issue はまだ評価されていません。