<mat-form-field>
<mat-label>Code</mat-label>
<input matInput formControlName="code" placeholder="Code" type="text" [readonly]="editMode"/>
<mat-error *ngIf="checkErrorForm('code', 'required')">Le code est obligatoire</mat-error>
<mat-error *ngIf="checkErrorForm('code', 'maxlength')">Le nombre de caractères est limité à 1</mat-error>
</mat-form-field>
...
...
form = this._formBuilder.group({
equipe: ['', [Validators.required, ], ],
code: ['', [Validators.required, Validators.maxLength(1),]],
the default operation is that when I enter characters even if I enter 5 characters, the error does not occur.
the error only appears when I leave the field.
I would like that when you enter 2 characters, the error is immediately displayed.
I have about ten fields as well.
What is the solution ?