Handling Disabled and Touched States
Reflect form state in your control.
Beyond The Value
A complete custom control respects two more form concepts: disabled state and touched state. These drive UX and validation display.
setDisabledState
Angular calls setDisabledState when the form control is disabled or enabled (for example via control.disable()). Reflect it in your component.
disabled = false;
setDisabledState(isDisabled: boolean): void {
this.disabled = isDisabled;
}All lessons in this course
- The ControlValueAccessor Interface
- Writing and Registering Values
- Handling Disabled and Touched States
- Validation in Custom Controls