bower install --save bc-phone-number
angular.module('myApp', ['bcPhoneNumber'])
npm install --save bc-phone-number
angular.module('myApp', [require('bc-phone-number')])
Just download the dist folder.
<bc-phone-number ng-model='theNumber' default-country='us' preferred-countries='us gb ca' is-valid='isValid'></bc-phone-number>
angular.module('myModule', ['bcPhoneNumber', function(bcPhoneNumber) {
scope.formattedNumber = bcPhoneNumber.format('966501234567');
scope.isValid = bcPhoneNumber.isValid(scope.formattedNumber);
}]);
Note thatng-model
and is-valid
are scope variables.