Browse Source
Merge pull request #7485 from engix-ltd/phone_input_default_country
[3.4.2] UI: Fix phone dial code detection for default country.
pull/7592/head
Igor Kulikov
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
4 additions and
3 deletions
-
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); |
|
|
|
|