<mat-form-field class="input-label-add">
<input matInput placeholder="Registration **" formControlName="registration">
<mat-error *ngIf="addLockerForm.get('registration').hasError('maxlength')">registration cannot exceed 8 characters</mat-error>
<mat-error *ngIf="addLockerForm.get('registration').errors">registration or surname is required</mat-error>
</mat-form-field>
this.addLockerForm = this.formBuilder.group({
locker_serial_number: [null, Validators.required],
customer_surname: [null],
registration: [null, Validators.maxLength(10)],
mobile: [null],
email: [null],
date_in: [null, Validators.required],
date_out: [null, Validators.required],
},
{ validator: [this.validateCustomerDetails, this.validateCustomerContact] });
addLockerForm.get ('registration'). HasError ('maxlength') остается ложным все время