Fix phone dial code detectino for default country.
This commit is contained in:
parent
4cc7e7b373
commit
92d4d1dfc9
@ -94,6 +94,9 @@ export class PhoneInputComponent implements OnInit, ControlValueAccessor, Valida
|
|||||||
set isLoad(value) {
|
set isLoad(value) {
|
||||||
if (this.isLoading) {
|
if (this.isLoading) {
|
||||||
this.isLoading = value;
|
this.isLoading = value;
|
||||||
|
if (this.defaultCountry) {
|
||||||
|
this.getFlagAndPhoneNumberData(this.defaultCountry);
|
||||||
|
}
|
||||||
if (this.phoneFormGroup) {
|
if (this.phoneFormGroup) {
|
||||||
this.defineCountryFromNumber(this.phoneFormGroup.get('phoneNumber').value);
|
this.defineCountryFromNumber(this.phoneFormGroup.get('phoneNumber').value);
|
||||||
}
|
}
|
||||||
@ -125,12 +128,10 @@ export class PhoneInputComponent implements OnInit, ControlValueAccessor, Valida
|
|||||||
this.validators.push(Validators.required);
|
this.validators.push(Validators.required);
|
||||||
}
|
}
|
||||||
this.phoneFormGroup = this.fb.group({
|
this.phoneFormGroup = this.fb.group({
|
||||||
country: [this.defaultCountry, []],
|
country: [null, []],
|
||||||
phoneNumber: [null, this.validators]
|
phoneNumber: [null, this.validators]
|
||||||
});
|
});
|
||||||
|
|
||||||
this.flagIcon = this.getFlagIcon(this.phoneFormGroup.get('country').value);
|
|
||||||
|
|
||||||
this.changeSubscriptions.push(this.phoneFormGroup.get('phoneNumber').valueChanges.subscribe(value => {
|
this.changeSubscriptions.push(this.phoneFormGroup.get('phoneNumber').valueChanges.subscribe(value => {
|
||||||
this.updateModel();
|
this.updateModel();
|
||||||
this.defineCountryFromNumber(value);
|
this.defineCountryFromNumber(value);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user