Created
July 23, 2016 15:38
-
-
Save kamikaz1k/bdfcad3dbb341b30164e4136c50de375 to your computer and use it in GitHub Desktop.
Phone Number form validation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function validateInput(fieldId) { | |
if (/US|CA/.test(scope.countryCode)) { | |
... | |
// pass | |
ngModelCtrl.$setValidity("validPhone", true); | |
scope.parentModel = phone.international; | |
... | |
// fail | |
ngModelCtrl.$setValidity("validPhone", false); | |
scope.parentModel = ""; | |
... | |
} else { | |
... | |
// pass | |
ngModelCtrl.$setValidity("validPhone", true); | |
scope.parentModel = phone.international; | |
... | |
// fail | |
ngModelCtrl.$setValidity("validPhone", false); | |
scope.parentModel = ""; | |
... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment