17 lines
292 B
JavaScript
17 lines
292 B
JavaScript
/* @ngInject */
|
|
export function autofocus($timeout) {
|
|
return {
|
|
restrict: 'A',
|
|
scope: {
|
|
shouldFocus: '='
|
|
},
|
|
link: function($scope, $element) {
|
|
$timeout(function() {
|
|
if ($scope.shouldFocus) {
|
|
$element[0].focus();
|
|
}
|
|
});
|
|
}
|
|
};
|
|
}
|