Angular forms

From my point of view,

If you have more than two inputs in an form, don’t use template driven forms.

When we are going with template driven forms for large forms, we will end up dealing with potential bugs.

So what should I use?

Just check.

What is Reactive forms?

Building forms with Functional Reactive Programming will help us to build feature like undo/redo quickly.

Handling various validation is quickly doable.

We can have features like partially update the form or fully update the form.

FormGroup have api methods called

patchValue() – partially update form

setValue() – fully updates the form (required all form fields)

You don’t have to set all fields to empty. The following single line will does that for you this.form.reset();

Your form gets to its initial state in one line of code.

Even we can mix up both the techniques in building forms.

That’s technically possible.

I personally wish to use it seperately.

Moral of story

If you are building new forms in your application.

USE reactive form..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s