Summary
In this chapter, you learned about Angular’s different types of forms. You now know the difference between template-driven and reactive forms and when to use which type. We created a template-driven form that includes validation, error messages, default values, and styling based on control statuses. We also created a custom validator directive for the template-driven form. Next, we recreated the same for using reactive forms.
We also created a custom validator function that can be used inside the reactive form. We learned about dynamically adding fields inside form group, form array, or form record classes inside the reactive form. Then, we learned how to change our fields’ update behavior in both template-driven and reactive forms. Lastly, you built a dynamic form that builds the form model based on a configuration and will render the form accordingly, including validations and error messages.
In the next chapter, you will learn how to create dynamic components...