我正在使用角度材料 6,当在 mat-form-field 之后移动到正确显示的 mat-error 时,mat-form-field mat-error 没有显示。
不工作代码:
<mat-form-field>
<input matInput type="time" formControlName="ToTime"/> <mat-error *ngIf="DaterForm.get('ToTime').hasError('InValidToTime')">FromTime Should be less than ToTime if choose a same date</mat-error>
</mat-form-field>
工作正常:
<input matInput type="time" formControlName="ToTime"/> </mat-form-field>
<mat-error *ngIf="DaterForm.get('ToTime').hasError('InValidToTime')">FromTime Should be less than ToTime if choose a same date</mat-error>
有人解释了为什么在该控件中不起作用。
现场演示: stackblitz