In this example, I have a reusable mat-form-field that should display mat-error 'required' if it has the error, else it should display mat-hint 'Optional'. The mat-hint never get displayed. Is this expected?
<mat-form-field>
<mat-label>Comments</mat-label>
<textarea matInput [formControl]="commentControl"></textarea>
@if (commentControl.hasError('required')) {
<mat-error>Required</mat-error>
} @else {
<mat-hint>Optional</mat-hint>
}
</mat-form-field>