From 92d4d1dfc92d9a49b3c0e2f2e23299e5287cb416 Mon Sep 17 00:00:00 2001 From: devaskim Date: Tue, 25 Oct 2022 21:09:39 +0500 Subject: [PATCH] Fix phone dial code detectino for default country. --- ui-ngx/src/app/shared/components/phone-input.component.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/shared/components/phone-input.component.ts b/ui-ngx/src/app/shared/components/phone-input.component.ts index a620fa6263..24627db127 100644 --- a/ui-ngx/src/app/shared/components/phone-input.component.ts +++ b/ui-ngx/src/app/shared/components/phone-input.component.ts @@ -94,6 +94,9 @@ export class PhoneInputComponent implements OnInit, ControlValueAccessor, Valida set isLoad(value) { if (this.isLoading) { this.isLoading = value; + if (this.defaultCountry) { + this.getFlagAndPhoneNumberData(this.defaultCountry); + } if (this.phoneFormGroup) { this.defineCountryFromNumber(this.phoneFormGroup.get('phoneNumber').value); } @@ -125,12 +128,10 @@ export class PhoneInputComponent implements OnInit, ControlValueAccessor, Valida this.validators.push(Validators.required); } this.phoneFormGroup = this.fb.group({ - country: [this.defaultCountry, []], + country: [null, []], phoneNumber: [null, this.validators] }); - this.flagIcon = this.getFlagIcon(this.phoneFormGroup.get('country').value); - this.changeSubscriptions.push(this.phoneFormGroup.get('phoneNumber').valueChanges.subscribe(value => { this.updateModel(); this.defineCountryFromNumber(value);