Skip to content

Commit

Permalink
Fixed #11384 - onChange event triggered for selectButton even when no…
Browse files Browse the repository at this point in the history
… change occurs
  • Loading branch information
yigitfindikli committed Apr 4, 2022
1 parent 1989abf commit 5b0deb7
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/app/components/selectbutton/selectbutton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,26 @@ export class SelectButton implements ControlValueAccessor {
this.removeOption(option);
else
this.value = [...(this.value||[]), this.getOptionValue(option)];

this.onModelChange(this.value);

this.onChange.emit({
originalEvent: event,
value: this.value
});
}
else {
this.value = this.getOptionValue(option);
let value = this.getOptionValue(option);

if (this.value !== value) {
this.value = this.getOptionValue(option);
this.onModelChange(this.value);

this.onChange.emit({
originalEvent: event,
value: this.value
});
}
}

this.onOptionClick.emit({
Expand All @@ -127,12 +144,6 @@ export class SelectButton implements ControlValueAccessor {
index: index
});

this.onModelChange(this.value);

this.onChange.emit({
originalEvent: event,
value: this.value
});
}

onBlur() {
Expand Down

0 comments on commit 5b0deb7

Please sign in to comment.