How can you access the value of a template-driven form control in the component class?

  • Using the formControlName directive.
  • Using the @ViewChild decorator.
  • Using the [(ngModel)] directive.
  • Using the Validators module.
To access the value of a template-driven form control in the component class, you can use the @ViewChild decorator. This allows you to reference the form control in the component, giving you access to its value and properties. While the other options are related to forms and validation in Angular, they do not directly provide a way to access the form control's value in the component class.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *