If your goal is to validate input, it's important to consider a user-friendly approach. Simply enforcing input without clear feedback can be frustrating for users who may not understand what they did wrong. A better validation strategy includes providing errors with explanations to help users correct their input.
(if you have other reasons for requesting this, feel free to disregard my comment)
For input validation, you can use the following pattern:
<input matInput type="text" [formControl]="your-control-name" pattern="[ a-zA-Z]*">
To handle validation errors related to the pattern, you can include the following code:
<mat-error *ngIf="formHandlersList[i].hasError('pattern')">
Only alphabetic characters are allowed
The complete HTML block would look something like this -
<mat-form-field appearance="standard" [style.width.px]="120">
<input matInput type="text" [formControl]="your-control-name" pattern="[ a-zA-Z]*">
<mat-error *ngIf="<your-form-control-object>.hasError('pattern')">
Only alphabetic characters are allowed
</mat-error>
</mat-form-field>