NG.VI · Angular 22 practice question

A developer is converting a template-driven form that used required and minlength attributes into a reactive form. How are those same built-in validators accessed in a reactive form?

Choose one answer
Check answer and explanation

Correct answer: As functions on the Validators class

Explanation

The same built-in validators available as HTML attributes in template-driven forms, such as required and minlength, are provided as functions on the Validators class for reactive forms.

Common trap

Validators are not pipes; they are functions attached to controls in the form model. The FormGroup constructor does not take boolean flags like required or minlength for individual controls.

Source: Angular docs: Validating form input — Built-in validator functions
Checked against the cited text on 2026-11-25.

Report an error in this question