international-phone-number icon indicating copy to clipboard operation
international-phone-number copied to clipboard

Binding the number with country code directly to the model

Open Meldinoor opened this issue 8 years ago • 5 comments

Hi, When I enter a number into an input field with this directive, it would be nice if the number were to be bound with the country dial code directly to the model. Is there an option for this already?

What I mean is, say I have the following input:

image

It would be nice if the value bound to the model could automatically be "+46723135423" but instead I get "0723135423". I have to call intlTelInput('getNumber') to get the value and it's frustrating to have to do this manually everywhere in the code.

Would it be alright if I implemented an option for this and made a pull request? (I'm new to github, not sure yet about the etiquette of making pull-requests)

Thanks!

Meldinoor avatar Mar 18 '16 08:03 Meldinoor

Hi meldinoor, did you ever get around that issue? If so, where can I find your solution?

Jordumus avatar May 20 '16 12:05 Jordumus

Hi Jordumus. I did fix it, but never got around to putting up a pull request. It's actually quite a small change, but I can make it available for you if you like.

Meldinoor avatar May 20 '16 13:05 Meldinoor

Give me a minute and I'll fork the project

Meldinoor avatar May 20 '16 13:05 Meldinoor

https://github.com/Meldinoor/international-phone-number

Meldinoor avatar May 20 '16 13:05 Meldinoor

Just set this option:

ipnConfig.nationalMode = false;

lindamarieb avatar Jul 06 '17 10:07 lindamarieb