Which directive in template-driven forms is used to display specific error messages based on validation failures?

  • *ngFor directive.
  • *ngIf directive.
  • *ngSwitch directive.
  • *ngTemplateOutlet directive.
In template-driven forms, the *ngIf directive is used to conditionally display error messages based on validation failures. You can use it to check the control's validity and display custom error messages as needed. The other directives listed have different purposes and are not typically used for displaying validation errors in template-driven forms.
Add your answer
Loading...

Leave a comment

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