Binding a Form

In this lesson, we'll learn how to bind the form to the form group in the class.

We'll cover the following...

We’ve created a form group, but for some reason, our app is no longer working. This is because, from the moment we registered the ReactiveFormsModule, Angular will expect every <form> element to be bound to a form group. In our template, we don’t have any bindings. Angular will throw an error in the console as a result.

Form binding

We can bind a form to an instance of the FormGroup class by binding the formGroup property on the <form> element. Let’s update the template in the app.component.html file.

<form
...