The errors property is a nullable ValidationErrors object on an Angular form-control validation state. Its properties correspond to validation attributes that currently fail, such as required, minlength, or pattern. section 13.4.2
Access it through a template reference variable assigned to ngModel. Each error entry provides details about the failed check, while the entry’s existence can control validation-message visibility. section 13.4.2
Displaying a required-field message
Use #name="ngModel" on the input, show the message list when name.dirty && name.invalid, and test the failure with *ngIf="name.errors?.['required']". For minlength, read name.errors?.['minlength'].requiredLength to avoid duplicating the configured limit.
