-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
29 lines (26 loc) · 839 Bytes
/
app.js
File metadata and controls
29 lines (26 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*global module:true, require:true */
(function () {
'use strict';
var angular,
MODULE_NAME = 'kt.autoFocus';
// Check for CommonJS support
if (typeof module === 'object' && module.exports) {
angular = require('angular');
module.exports = MODULE_NAME;
} else {
angular = window.angular;
}
angular.module(MODULE_NAME, []).directive('ktAutoFocus', function ($timeout) {
return {
link: function (scope, element, attrs) {
scope.$watch(attrs.ktAutoFocus, function (value) {
if (angular.isDefined(value) && value) {
$timeout(function () {
element[0].focus();
});
}
}, true);
}
};
});
}());