Control classes and directive
- In angular we have two classes to keep track of the state of input fields and their validity
Formcontrolwhich represents one input field- When we apply
ngModeldirective on the input field angular automatically creates a formcontrol object and associates that with the input field Formgroupwhich represents a group of input fields- Used to represent a entire form and optionally groups within the form
ngFormis applied automatically to all form elements and creates a form group object and associates with the form. It tracks the state changes of form and their validity.- When you have complex form with mulitple subgroups, you can optionally apply
ngModelGroupdirective on subgroup creates a form group object for that sub group - ngForm exposes output property
ngSubmitwhich is used to handle submit events of form,ngModelGroupdoesn't