I use ngx-mat-intl-tel-input in an Angular 16 project.
I have two validations. A required validation and a maxlength validation.
I would excpect a required error when the field is still empty and a maxlength error when it exceeds the maxlength.
The problem is that I get a required error in both cases.
So in my case, the validationmessage the user gets to see is the required validation message instead of the maxlength when it enters a number that is too long.
In the .ts file:
public fgNewUser = this._formBuilder.group({ edtPhoneNumber: ['', [Validators.required, Validators.maxLength(20)]], });
in the .html file:
`
Input your phone number
Phone number is required
Phone number has a maximum length of 20 characters"
I use ngx-mat-intl-tel-input in an Angular 16 project.
I have two validations. A required validation and a maxlength validation. I would excpect a required error when the field is still empty and a maxlength error when it exceeds the maxlength.
The problem is that I get a required error in both cases. So in my case, the validationmessage the user gets to see is the required validation message instead of the maxlength when it enters a number that is too long.
In the .ts file:
public fgNewUser = this._formBuilder.group({ edtPhoneNumber: ['', [Validators.required, Validators.maxLength(20)]], });
in the .html file: `
`
The result when I enter more then 20 numbers