https://rc125.github.io/angularjs-intl-tel-input/
-
Download the jackocnr/intl-tel-input latest release
-
Include the stylesheet
<link rel="stylesheet" href="path/to/intlTelInput.css">- Override the path to flags.png in your CSS
.iti__flag {background-image: url("path/to/flags.png");}
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
.iti__flag {background-image: url("path/to/flags@2x.png");}
}- Add the plugin script and initialise it on your input element
<input type="tel" id="phone">
<script src="path/to/intlTelInput.js"></script>
<script>
var input = document.querySelector("#phone");
window.intlTelInput(input);
</script>- Recommended: initialise the plugin with the
utilsScriptoption to enable formatting/validation, and to allow you to extract full international numbers usinggetNumber.
Inject ngIntlTelInput into your application module
var myApp = angular.module('myApp', ['ngIntlTelInput']);Configure defaults
See: https://github.com/Bluefieldscom/intl-tel-input#options
angular.module('myApp')
.config(function (ngIntlTelInputProvider) {
ngIntlTelInputProvider.set({initialCountry: 'us'});
});This attribute applies intl-tel-input to a text field.
<input type="text" ng-model="model.tel" ng-intl-tel-input>Note
typeis set to text or telng-modelis specified (required)
This attribute allows run-time setting of the default country.
<input type="text" ng-model="model.tel" ng-intl-tel-input data-initial-country="gb">