I have a switch component that implements ControlValueAccessor (to implement custom form control to use in reactive form). Tried to refactor it using signal.
checked = model(false);
constructor() {
effect(() => {
this.onChange(this.checked());
this.checkedChange.emit(this.checked());
});
}
writeValue(value: boolean): void {
this.checked.set(value);
}
I'm running into error where this control will set form dirty on init. This is because effect detect checked signal is updated in writeValue function. What is suggested pattern to update form value change?