ng2-tel-input icon indicating copy to clipboard operation
ng2-tel-input copied to clipboard

flag not changed automatically while edit form

Open ShaileshInfyom opened this issue 6 years ago • 11 comments

i have used in reactive form method. code here issue: when i open edit screen and patch a value into form. working fine. value displaying into input correctly but flag not changed. default flag appear. one i have change value then flag changed. value after patch for ex. +917878747474

<input type="text"   formControlName="value_field"
 ng2TelInput
[ng2TelInputOptions]="{initialCountry: 'us'}"
(hasError)="hasError($event)"
(ng2TelOutput)="hasOutPut($event)"
(countryChange)="onCountryChange($event)"
maxlength="45"/>

please help me how to achieve this and fixed my problem. thanks in advance.

ShaileshInfyom avatar Jan 01 '18 10:01 ShaileshInfyom

any update?

ShaileshInfyom avatar Feb 08 '18 11:02 ShaileshInfyom

You can get original intlTelInput object once this loaded. After this you can do something like below after editing :- this.intlObj.intlTelInput("setCountry", "gb");

You can check the readme file to how to get intlTelInput instance.

gauravsoni119 avatar Sep 08 '18 19:09 gauravsoni119

Yes. I know but I haven't country code. just phone number available with country code. for eg. +917878747474

ShaileshInfyom avatar Sep 10 '18 04:09 ShaileshInfyom

For me it's working, if I do like

this.intlObj.intlTelInput("setNumber", "+917878747474");

then it will automatically change your flag. May be you can check your css file loaded properly or not.

gauravsoni119 avatar Sep 10 '18 19:09 gauravsoni119

For me it's working, if I do like

this.intlObj.intlTelInput("setNumber", "+917878747474");

then it will automatically change your flag. May be you can check your css file loaded properly or not.

@gauravsoni119 setNumber is not working for me ... UPDATE: the readme file says that i should use utils.js, how to import it in ionic 3 application ?

georgenacouzi avatar Sep 24 '18 12:09 georgenacouzi

how you are getting this this.intlObj object in class method?

mkpasala avatar Dec 05 '18 12:12 mkpasala

Any updates? I am facing the same issue. Flag is not changed for default value when it's filled from code.

akvaliya avatar Dec 20 '18 12:12 akvaliya

how you are getting this this.intlObj object in class method?

@mkpasala

(intlTelInputObject)="telInputObject($event)" in the html

telInputObject(obj) {
    obj.intlTelInput('setCountry', this.country);
  }

in .ts file

georgenacouzi avatar Dec 28 '18 08:12 georgenacouzi

how to save the flag with the input field.plz share the code to save flag in reactive form @Learath2 @MatissJanis @timoweiss @jhades @Learath2 plz help me @gauravsoni119

akilljain avatar Jun 05 '20 16:06 akilljain

i have used in reactive form method. code here issue: when i open edit screen and patch a value into form. working fine. value displaying into input correctly but flag not changed. default flag appear. one i have change value then flag changed. value after patch for ex. +917878747474

<input type="text"   formControlName="value_field"
 ng2TelInput
[ng2TelInputOptions]="{initialCountry: 'us'}"
(hasError)="hasError($event)"
(ng2TelOutput)="hasOutPut($event)"
(countryChange)="onCountryChange($event)"
maxlength="45"/>

please help me how to achieve this and fixed my problem. thanks in advance.

can u solve it plz provided the solutions

akilljain avatar Jun 06 '20 08:06 akilljain

Put Ng2TelInputModule after FormsModule, ReactiveFormsModule in app module****

mevijaysaini avatar Jan 21 '21 15:01 mevijaysaini