Skip to content

Commit f1f3d4f

Browse files
authored
feat(ui5-select): implement angular two way data binding (#1583)
1 parent 8e0463f commit f1f3d4f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/main/src/Select.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ class Select extends UI5Element {
391391
this._selectedIndex = nextIndex === -1 ? this._selectedIndex : nextIndex;
392392

393393
if (shouldFireEvent) {
394-
this.fireEvent("change", { selectedOption: this.options[nextIndex] });
394+
this._fireChangeEvent(this.options[nextIndex]);
395395
}
396396
}
397397

@@ -424,11 +424,19 @@ class Select extends UI5Element {
424424
this._select(this._selectedIndexBeforeOpen);
425425
this._escapePressed = false;
426426
} else if (this._lastSelectedOption !== this.options[this._selectedIndex]) {
427-
this.fireEvent("change", { selectedOption: this.options[this._selectedIndex] });
427+
this._fireChangeEvent(this.options[this._selectedIndex]);
428428
this._lastSelectedOption = this.options[this._selectedIndex];
429429
}
430430
}
431431

432+
_fireChangeEvent(selectedOption) {
433+
this.fireEvent("change", { selectedOption });
434+
435+
// Angular two way data binding
436+
this.selectedItem = selectedOption;
437+
this.fireEvent("selected-item-changed");
438+
}
439+
432440
get valueStateTextMappings() {
433441
const i18nBundle = this.i18nBundle;
434442

0 commit comments

Comments
 (0)