18 lines
364 B
JavaScript
18 lines
364 B
JavaScript
angular
|
|
.module('app.frontend')
|
|
.directive('snAutofocus', ['$timeout', function($timeout) {
|
|
return {
|
|
restrict: 'A',
|
|
scope: {
|
|
shouldFocus: "="
|
|
},
|
|
link : function($scope, $element) {
|
|
$timeout(function() {
|
|
if($scope.shouldFocus) {
|
|
$element[0].focus();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}]);
|