Skip to content

Instantly share code, notes, and snippets.

@kamikaz1k
Last active July 23, 2016 15:54
Show Gist options
  • Save kamikaz1k/eef63462ab026a00060c9feaecee72d0 to your computer and use it in GitHub Desktop.
Save kamikaz1k/eef63462ab026a00060c9feaecee72d0 to your computer and use it in GitHub Desktop.
Phone Number Directive autofocus
link: function postLink (scope, element, attributes, ngModelCtrl) {
...
function splitModel (fieldId) {
...
// If areaCode exists, and current focus is on
if (phone.areaCode && fieldId === "area") {
element.find("#phoneOne").focus();
}
else if (phone.phoneOne && fieldId === "one") {
element.find("#phoneTwo").focus();
}
...
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment