Skip to main content

Custom form controls and ControlValueAccessor

Learn Custom form controls and ControlValueAccessor (Module 11 · Angular Forms, Angular) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Your own input component • A custom form control is a component (a star rating, a date picker, a tag input) that can be used with formControlName or [(ngModel)] just like a normal input. • The glue is ControlValueAccessor (CVA): an interface that tells Angular how to write a value into your component and how your component reports changes. Think of it as an adapter plug between the forms system and your component, like a Java interface that lets any class be used as a Comparator.

More lessons in Module 11 · Angular Forms