Last active
July 23, 2016 15:54
-
-
Save kamikaz1k/eef63462ab026a00060c9feaecee72d0 to your computer and use it in GitHub Desktop.
Phone Number Directive autofocus
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
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