Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 5- Difference between reactive and Dynamic forms

Tags:

What is the difference between reactive and dynamic forms? What i understood regarding dynamic forms is to create the forms dynamically, based on metadata that describes the business object model. I am not clear on this explanation.

like image 714
Adnan Abdul Khaliq Avatar asked Feb 05 '18 10:02

Adnan Abdul Khaliq


1 Answers

From the docs on Reactive forms

Reactive forms provide a model-driven approach to handling form inputs whose values change over time. This guide shows you how to create and update a simple form control, progress to using multiple controls in a group, validate form values, and implement more advanced forms.

And Dynamic forms...

Building handcrafted forms can be costly and time-consuming, especially if you need a great number of them, they're similar to each other, and they change frequently to meet rapidly changing business and regulatory requirements. It may be more economical to create the forms dynamically, based on metadata that describes the business object model.

So, dynamic forms are created directly from the code in the component. If you're faced with changing requirements and your forms need to constantly change, you can change them without even touching the template. They use reactive forms to work. And reactive forms are a way of describing the form from the component (not the template) so that you can control the validation and the logic associated to it.

like image 95
Gaby Garro Avatar answered Sep 21 '22 13:09

Gaby Garro