Template Driven Form and Reactive Form
Template Driven Form and Reactive Form
Table of Contents
- Why not Template Driven Forms? Why Reactive Forms?
- What is Fluent Validation?
Why not Template Driven Forms? Why Reactive Forms?
- Contains little code in the component class as its logic contains in (template) html.
- Easier to set up .
- Difficult to add controls dynamically.
- Unit testing is a challenge because logic are in template(html) not in typescript.
- Their readability will quickly drop as we add more and more validators and input tags; keeping all their logic within the template might be fine for small forms, but it doesn't scale well when dealing with complex data items.
- More flexible than template driven form.
- Handles any complex scenarios.
- No data binding is done (immutable data model preferred by most developers).
- More component code and less HTML markup.
- Easier unit testing.
- Model-driven(Reactive) forms are used in creating medium to large scale applications.
- It provides flexibility to add client-side validation.
- Moreover we can create custom validator.
Post a Comment
0 Comments