Skip to content

Instantly share code, notes, and snippets.

@neopablix
Last active October 12, 2016 21:30
Show Gist options
  • Save neopablix/ebdd58680b3e1b242263d73dfa68ba79 to your computer and use it in GitHub Desktop.
Save neopablix/ebdd58680b3e1b242263d73dfa68ba79 to your computer and use it in GitHub Desktop.
Angular focus on show element
.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