ng2-tel-input
ng2-tel-input copied to clipboard
flag not changed automatically while edit form
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.
any update?
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.
Yes. I know but I haven't country code. just phone number available with country code. for eg. +917878747474
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.
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 ?
how you are getting this this.intlObj object in class method?
Any updates? I am facing the same issue. Flag is not changed for default value when it's filled from code.
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
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
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
Put Ng2TelInputModule after FormsModule, ReactiveFormsModule in app module****