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..

Do what you love!

The stats you are seeing is my blog views and performance in past few years ☺️

Sometimes people will laugh at your passion, think you are doing stupid things and wasting time.

But they never know that you do what you love.

Same happened when I started blogging few years back.

People laughed when I tell them I started a blog.

Even they laughed harder when I say I’m going to put only technical contents.

And someone said, make cinema content you’ll get more views.

I said I can do only what I love. Even if I get only one view per year, that’ll make me happy. Tech blogging is my passion. I love writing technical stuffs as simple as possible.

BTW I didn’t write for others all time, mostly I write for myself. And it also useful for others at some point. That’s it.

If you are reading till this, I have a message for you. You may have some dream or passion or things you wish to do.

Just go for it. Ignore the external forces, follow your passion. Start with small, one step at a time. Incremental progress matters!

Get started and your passion will lead you!