...

/

Template-driven vs. Model-driven forms

Template-driven vs. Model-driven forms

In this lesson, we will learn about Angular forms, their different types, and the differences between these types.

We'll cover the following...

Angular uses forms to handle user input. Angular provides the following two different approaches for managing this input.

  • Template-driven approach
  • Model-driven approach/Reactive approach

Let’s discuss each one of these.

Template-driven forms

Template-driven forms allow us to create simple forms where we can use directives likengModel. We need to import them using FormsModule from the @angular/forms package as they are not available by default like in AngularJS.

The following example shows a simple template-driven form.

<form #form="ngForm" (ngSubmit)="onSubmit()">
  
...