mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
Rename task-focus focus-element
This commit is contained in:
@@ -3,18 +3,18 @@
|
||||
(function(){
|
||||
angular
|
||||
.module('habitrpg')
|
||||
.directive('taskFocus', taskFocus);
|
||||
.directive('focusElement', focusElement);
|
||||
|
||||
taskFocus.$inject = ['$timeout'];
|
||||
focusElement.$inject = ['$timeout'];
|
||||
|
||||
/**
|
||||
* Directive that places focus on the element it is applied to when the
|
||||
* expression it binds to evaluates to true.
|
||||
*/
|
||||
|
||||
function taskFocus($timeout) {
|
||||
function focusElement($timeout) {
|
||||
return function($scope, elem, attrs) {
|
||||
$scope.$watch(attrs.taskFocus, function(newVal) {
|
||||
$scope.$watch(attrs.focusElement, function(newVal) {
|
||||
if (newVal) {
|
||||
$timeout(function() {
|
||||
elem[0].focus();
|
||||
|
||||
Reference in New Issue
Block a user