ReactiveFormsModule vs. FormsModule in Angular2

muetzerich picture muetzerich · Sep 22, 2016 · Viewed 19.5k times · Source

There exists the ReactiveFormModule and the FormsModule.

import {
  FormsModule,
  ReactiveFormsModule
} from "@angular/forms";

When should I use the ReactiveFormModule and what provides this module comparing to the FormModule.

Answer

oto lolua picture oto lolua · Sep 22, 2016

Formsmodule - Angular 1 tackles forms via the famous ng-model directive. Angular 2 now provides an identical mechanism named also ngModel, that allow us to build what is now called Template-Driven forms.

Unlike the case of AngularJs, ngModel and other form-related directives are not available by default.

ReactiveFormsModule is for model driven forms. Each form has a state that can be updated by many different interactions and its up to the application developer to manage that state and prevent it from getting corrupted. This can get hard to do for very large forms and can introduce a category of potential bugs.

Where you can write Validations not in html. In this case you can attach many Validations and wrap form.

I got this from here. There is better explanation: