Emily Xiong
1 min readDec 4, 2020

--

The only concern I have about template-driven form is validation. It is very easy to do `required`, `minValue`, `regex` type of validation. However, if I got a more complex type of validation like "this field is only required if another radio button is checked", I am not sure what the approach for template-driven would be.

Another issue is how do you tell that the entire form is valid or not (to enable the submit button)? For reactive form, it is easy, form.valid. Also, not sure what the approach for template-driven would be.

As mentioned in the blog, it is easy to integrate with NGXS form https://www.ngxs.io/plugins/form to persist form value after refreshing the page.

Also, it is mentioned in Angular site https://angular.io/guide/forms-overview#choosing-an-approach:

`Compared to template-driven forms, they are more robust: they're more scalable, reusable, and testable. If forms are a key part of your application, or you're already using reactive patterns for building your application, use reactive forms.`

--

--

Emily Xiong
Emily Xiong

Written by Emily Xiong

A frontend web developer in Toronto

Responses (1)