salix/client/core/src/directives/focus.js

17 lines
376 B
JavaScript
Raw Normal View History

2017-02-07 13:34:26 +00:00
import {module} from '../module';
2017-02-07 13:34:26 +00:00
/**
* Sets the focus and selects the text on the directive element.
*/
export function directive() {
return {
restrict: 'A',
link: function($scope, $element, $attrs) {
var input = $element[0];
input.focus();
input.select();
}
};
}
module.directive('vnFocus', directive);