Angular ReactiveForm Error Handling Through Switch Case
问题 I have a reactive form in which I validate the different fields with ngif. For example: <mat-form-field> <input matInput formControlName="name" placeholder="Name"> <mat-error *ngIf="personForm.get('name').hasError('required')">Name is empty</materror> <mat-error *ngIf="personForm.get('name').hasError('minlength')">Needs more than 3 characters</mat-error> </mat-form-field> Would it be possible to do the same thing in a switch case statement and how would one go on about doing this? I imagened