Skip to content

Commit e369aef

Browse files
authored
feat(ui5-select): support angular reactive forms (#3323)
1 parent a8af480 commit e369aef

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/main/src/Select.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,8 @@ class Select extends UI5Element {
380380
let lastSelectedOptionIndex = -1,
381381
firstEnabledOptionIndex = -1;
382382
const opts = this.options.map((opt, index) => {
383-
if (opt.selected) {
383+
if (opt.selected || opt.textContent === this.value) {
384+
// The second condition in the IF statement is added because of Angular Reactive Forms Support(Two way data binding)
384385
lastSelectedOptionIndex = index;
385386
}
386387
if (!opt.disabled && (firstEnabledOptionIndex === -1)) {
@@ -600,7 +601,7 @@ class Select extends UI5Element {
600601
this.fireEvent("change", { selectedOption });
601602

602603
// Angular two way data binding
603-
this.selectedItem = selectedOption;
604+
this.selectedItem = selectedOption.textContent;
604605
this.fireEvent("selected-item-changed");
605606
}
606607

0 commit comments

Comments
 (0)