Last active
October 12, 2016 21:30
-
-
Save neopablix/ebdd58680b3e1b242263d73dfa68ba79 to your computer and use it in GitHub Desktop.
Angular focus on show element
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
.directive('showFocus', function($timeout) { | |
return function(scope, element, attrs) { | |
scope.$watch(attrs.showFocus, | |
function (newValue) { | |
$timeout(function() { | |
newValue && element[0].focus(); | |
}); | |
},true); | |
}; | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment