mareczek/international-phone-number

Set a default country dynamically

Opened this issue · 0 comments

Is it possible to set the default country by passing through the country iso2 model. I have tried the following strategies:

  1. Assign the user country iso code to the default country option

<input class="schedule-input" type="text" name="phone" id="phone" international-phone-number ng-model="newAppointment.phone" ng-click="checkCountry()" default-country="{{user_country.iso}}" />
2) Set the default country in the controller:
angular.element('#phone').intlTelInput("selectCountry", 'gb')
angular.element('#phone').intlTelInput("setCountry", 'gb')

(tried both selectCountry and setCountry to no avail)

Any feedback would be helpful