I am using template driven pattern to check if input is valid email and uses mat error to display it but it somehow does not work and I dont really understand why , as you can see in my code below I dont think there is still other way to do it , any idea why it does works guys ? Thanks.
whatever input it is always red even the email format is correct , why is that ?
<mat-form-field appearance="fill" fxFlex="30">
<mat-label>EMAIL ADDRESS</mat-label>
<input matInput type="email" pattern="^[a-zA-Z0-9._% -] @[a-zA-Z0-9.-] \.[a-zA-Z]{2,4}$" [(ngModel)]="model.email"
maxLength="100" #email="ngModel" required [readonly]="odel.assetStatus === 'Done'">
<mat-error *ngIf="!model.email ">Inspector
email is required.</mat-error>
<mat-error *ngIf="email.errors?.maxLength">Max
length is 100.</mat-error>
<mat-error *ngIf="(email.errors && (email.invalid || email.touched))">InvalidEmail.</mat-error>
</mat-form-field>
