tanansatpal / ngx-mat-intl-tel-input

MIT License
62 stars 114 forks source link

spaces and dashes are not removed from input #147

Open szabinagy opened 2 years ago

szabinagy commented 2 years ago

I used the ngx-mat-intl-tel-input in a reactive form. After submitting the form I call reset(currentFormValue) on the formGroup, so the form state must be reset with the given values. In the ngx-mat-intl-tel-input the selected country is Switzerland and the value is 745557 --- 966 ---. This is valid, and after the form reset it remains like this. The model value is correct +41745557966 but the input shows with spaces and dashes. So you can add spaces and dashes everywhere in the input without any issues, after you entered a correct phone number. Can you please display the model value in the input field after blur event or something like that? Thanks!

tanansatpal commented 2 years ago

Hi @szabinagy, this library depends on libphonenumber-js which returns the proper numberInstance even if it contains dashes and spaces. This is something that can't be handled in here