Skip to content

Commit

Permalink
validating dialCode of current country should return true
Browse files Browse the repository at this point in the history
  • Loading branch information
mareczek committed Aug 26, 2015
1 parent 7bf5c90 commit d57adcc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion releases/international-phone-number.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@
return value.replace(/[^\d]/g, '');
});
ctrl.$validators.internationalPhoneNumber = function(value) {
if (!value) {
var selectedCountry;
selectedCountry = element.intlTelInput('getSelectedCountryData');
if (!value || (selectedCountry && selectedCountry.dialCode === value)) {
return true;
}
return element.intlTelInput("isValidNumber");
Expand Down
2 changes: 1 addition & 1 deletion releases/international-phone-number.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/international-phone-number.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ angular.module("internationalPhoneNumber", []).directive 'internationalPhoneNumb
value.replace(/[^\d]/g, '')

ctrl.$validators.internationalPhoneNumber = (value) ->
if !value
selectedCountry = element.intlTelInput('getSelectedCountryData')

if !value || (selectedCountry && selectedCountry.dialCode == value)
return true

element.intlTelInput("isValidNumber")
Expand Down

0 comments on commit d57adcc

Please sign in to comment.