tanansatpal / ngx-mat-intl-tel-input

MIT License
62 stars 114 forks source link

Validation in Angular 16 does not work correctly #184

Open pwlagemaat opened 1 year ago

pwlagemaat commented 1 year ago

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"

`

The result when I enter more then 20 numbers image

rbalet commented 3 months ago

@pwlagemaat Can you try this cloned library out and let me know if this works again ?