What are the differences between ReactiveFormsModule and FormsModule?

1.0K    Asked by MarieBroadber in Python , Asked on Jan 7, 2020
Answered by Arun Singh

Formsmodule: 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. With FormsModule it's a bit more complicated since you need to deploy your application and test it using a browser (or Phantomjs).

ReactiveFormsModule: It is for model driven forms. Each form has a state that can be updated by many different interactions and it’s 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. ReactiveFormsModule can be unit tested the form validation logic just by instantiating the class, adding some value to the form and running the test.



Your Answer

Interviews

Parent Categories