Angular · Junior · Question 46 of 75

How do you connect a reactive form to the template?

form = new FormGroup({
  email: new FormControl("", { nonNullable: true, validators: [Validators.required, Validators.email] }),
});

Explanation

Directives from ReactiveFormsModule link the DOM to the controls. The value is in form.value (or getRawValue()) and the validity in form.valid.

Further reading

Problem with a question

Angular · Junior · question 46

Test yourself

Take the Angular · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz