mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
26 lines
459 B
JavaScript
26 lines
459 B
JavaScript
'use strict';
|
|
|
|
(function(){
|
|
angular
|
|
.module('habitrpg')
|
|
.directive('focusMe', focusMe);
|
|
|
|
focusMe.$inject = [
|
|
'$timeout',
|
|
'$parse'
|
|
];
|
|
|
|
function focusMe($timeout, $parse) {
|
|
return {
|
|
link: function($scope, element, attrs) {
|
|
var model = $parse(attrs.focusMe);
|
|
$scope.$watch(model, function(value) {
|
|
$timeout(function() {
|
|
element[0].focus();
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}());
|