You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behaviour:
If button change is clicked there is no output in console (because of emitEvent is set to false)
Actual behaviour:
If button change is clicked there is "Changed" output in console (emitEvent option does not work)
Reason of this strange behaviour is because onChange is called while setting value (in writeValue method), but it was added because some kind of bug - 1382bb1
The text was updated successfully, but these errors were encountered:
writeValue(obj: any): void {
if (obj !== this.checked) {
this.checked = !!obj;
}
this.onChangeCallback(this.checked); // <---- HERE
if (this.cdr) {
this.cdr.markForCheck();
}
}
Why would you want to call the CVA callback when you receive a new value? You should call it only when the internal value has changed after a user action.
If ui-switch is part of reactive forms and there is set or patch method used with option emit event false it does not work.
Example code for demo:
demo.component.ts
demo.component.html
Expected behaviour:
If button change is clicked there is no output in console (because of emitEvent is set to false)
Actual behaviour:
If button change is clicked there is "Changed" output in console (emitEvent option does not work)
Reason of this strange behaviour is because onChange is called while setting value (in writeValue method), but it was added because some kind of bug - 1382bb1
The text was updated successfully, but these errors were encountered: