# Template-Driven Forms Template-driven forms use two-way data binding (`[(ngModel)]`) to update the data model in the component as changes are made in the template and vice versa. They are ideal for simple forms and use directives in the HTML template to manage form state and validation. ## Core Directives Template-driven forms rely on the `FormsModule` which provides these key directives: - `NgModel`: Reconciles value changes in the form element with the data model (`[(ngModel)]`). - `NgForm`: Automatically creates a top-level `FormGroup` bound to the `
``` ## Form and Control State Angular automatically applies CSS classes to controls and forms based on their state: | State | Class if True | Class if False | | :------------- | :-------------------------------- | :------------- | | Visited | `ng-touched` | `ng-untouched` | | Value Changed | `ng-dirty` | `ng-pristine` | | Value is Valid | `ng-valid` | `ng-invalid` | | Form Submitted | `ng-submitted` (on `