angular.module('dssWebApp') .directive('showFocus', function ($timeout) { return function(scope, element, attrs) { scope.$watch(attrs.showFocus, function (newValue) { $timeout(function() { newValue && element.focus(); }); },true); }; });