mareczek / international-phone-number

AngularJS directive implementing intl-tel-input (https://github.com/Bluefieldscom/intl-tel-input)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Save/use selected country

geoffreyvd opened this issue · comments

So I am not sure if it's just me, but I can't find out how to use the selected Country code.
I don't really get it, I mean why can a user select a country while it won't be even used/saved?!

So I want to use this repository but really need this to work, thanks in advance, like to hear from u asap.

Duplicate of #70

@GaloisGirl thank you for the answer..!

I was looking for the same answer and I ended up using another directive instead: https://github.com/hodgepodgers/ng-intl-tel-input. Its model is the full phone number, country code included.

Awesome, thank you!

To obtain the country code, you can use element.intlTelInput("getSelectedCountryData"), and return this value in your directive

it will return something like this:

{
name: "Afghanistan (‫افغانستان‬‎)",
iso2: "af",
dialCode: "93"
}

Source: https://github.com/jackocnr/intl-tel-input#options