Refactors most controllers and directives into classes for more organized and maintainable code
This commit is contained in:
16
app/assets/javascripts/directives/functional/autofocus.js
Normal file
16
app/assets/javascripts/directives/functional/autofocus.js
Normal file
@@ -0,0 +1,16 @@
|
||||
/* @ngInject */
|
||||
export function autofocus($timeout) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
scope: {
|
||||
shouldFocus: '='
|
||||
},
|
||||
link: function($scope, $element) {
|
||||
$timeout(function() {
|
||||
if ($scope.shouldFocus) {
|
||||
$element[0].focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user