Skip to content

Commit 6af8dfb

Browse files
committed
Merge remote-tracking branch 'cialfo/bugfix/fix-countries-sorting' into bugfix/fix-countries-sorting
2 parents 124d037 + b15dd5a commit 6af8dfb

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

projects/ngx-intl-tel-input/src/lib/ngx-intl-tel-input.component.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ export class NgxIntlTelInputComponent implements OnInit, OnChanges {
117117
}
118118

119119
/*
120-
This is a wrapper method to avoid calling this.ngOnInit() in writeValue().
121-
Ref: http://codelyzer.com/rules/no-life-cycle-call/
122-
*/
120+
This is a wrapper method to avoid calling this.ngOnInit() in writeValue().
121+
Ref: http://codelyzer.com/rules/no-life-cycle-call/
122+
*/
123123
init() {
124124
this.fetchCountryData();
125125
if (this.preferredCountries.length) {
@@ -227,6 +227,7 @@ export class NgxIntlTelInputComponent implements OnInit, OnChanges {
227227
: this.selectedCountry.iso2;
228228
if (countryCode && countryCode !== this.selectedCountry.iso2) {
229229
const newCountry = this.allCountries
230+
.slice()
230231
.sort((a, b) => {
231232
return a.priority - b.priority;
232233
})
@@ -418,9 +419,9 @@ export class NgxIntlTelInputComponent implements OnInit, OnChanges {
418419
let matchedCountry = mainCountry ? mainCountry.iso2 : undefined;
419420

420421
/*
421-
Iterate over each secondary country and check if nationalNumber starts with any of areaCodes available.
422-
If no matches found, fallback to the main country.
423-
*/
422+
Iterate over each secondary country and check if nationalNumber starts with any of areaCodes available.
423+
If no matches found, fallback to the main country.
424+
*/
424425
secondaryCountries.forEach(country => {
425426
// @ts-ignore
426427
country.areaCodes.forEach(areaCode => {

0 commit comments

Comments
 (0)