mareczek / international-phone-number

AngularJS directive implementing intl-tel-input (https://github.com/Bluefieldscom/intl-tel-input)
139 stars 131 forks source link

Set a default country dynamically #129

Open dant672 opened 6 years ago

dant672 commented 6 years ago

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