Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add countryCode number to the intitialCountry #60

Open
rbalet opened this issue Nov 8, 2019 · 0 comments
Open

add countryCode number to the intitialCountry #60

rbalet opened this issue Nov 8, 2019 · 0 comments

Comments

@rbalet
Copy link

rbalet commented Nov 8, 2019

What
Beeing able to give a number instead of an string into the ng2TellInputOptions.

[ng2TelInputOptions]="{ initialCountry:  41}"

Why
I become countryCode (ex: 41) frome the db, which doesn't save the countryName (ex: ch) and want to initialise the flag with this number

How
I think, using te geoIpLookup from intl-tel-input could be an idea, they user the initialCountry: "auto", and then, instead of the geoIpLookup we could use our own function that look for the countryName.

intl-tel-input

intlTelInput(input, {
  initialCountry: "auto",
  geoIpLookup: function(success, failure) {
    $.get("https://ipinfo.io", function() {}, "jsonp").always(function(resp) {
      var countryCode = (resp && resp.country) ? resp.country : "";
      success(countryCode);
    });
  },
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant