Angular 需要角形/图案验证不起作用

Angular 需要角形/图案验证不起作用,angular,validation,angular-validation,Angular,Validation,Angular Validation,我有一个简单的表单,其中包含一个文本框。我在这个文本框中添加了必需的和模式验证。当文本框为空或不匹配模式但不显示错误消息时,它在文本框上添加了红色borer <mat-error *ngIf="messageForm.get('message').hasError('required')"> Contact full name is <strong>required</strong> </mat-err

我有一个简单的表单,其中包含一个文本框。我在这个文本框中添加了必需的和模式验证。当文本框为空或不匹配模式但不显示错误消息时,它在文本框上添加了红色borer

<mat-error *ngIf="messageForm.get('message').hasError('required')">
              Contact full name is <strong>required</strong>
            </mat-error>
我还创建了一个示例。请找到它

<mat-error *ngIf="messageForm.get('message').hasError('required')">
              Contact full name is <strong>required</strong>
            </mat-error>

您能在此提供帮助吗?

例如:

<mat-error *ngIf="messageForm.get('message').hasError('required')">
              Contact full name is <strong>required</strong>
            </mat-error>

联系人全名为必填项

祝你好运

您需要自己添加mat error组件,并在该控件有错误时显示该组件。该控件不适用于我。你能帮我更新一下吗。
<mat-error *ngIf="messageForm.get('message').hasError('required')">
              Contact full name is <strong>required</strong>
            </mat-error>