webcat12345 / ngx-intl-tel-input

Phone number input field to support international numbers, Angular
MIT License
213 stars 339 forks source link

Countries sorting order gets disturbed when enableAutoCountrySelect is true #396

Open ahmedConrad opened 3 years ago

ahmedConrad commented 3 years ago

I am using a reactive form in angular 12 with this component. When I supply a value using formControl.patchValue('+12345552'), the sorting order of countries gets messed up.

ngx-intl-tel-input

I was able find the code which is causing the issue https://github.com/webcat12345/ngx-intl-tel-input/blob/58096ab0f31576632c8c3e56d5c29c8c93ccd96f/projects/ngx-intl-tel-input/src/lib/ngx-intl-tel-input.component.ts#L232-L237

Since sorting in javascript happens in-place, it changes the original array.