umb-locked-field: auto focus field when unlocked

This commit is contained in:
Mads Rasmussen
2015-08-25 10:54:03 +02:00
parent 126c6f8be6
commit 0ea15d630c

View File

@@ -33,9 +33,25 @@ angular.module("umbraco.directives")
}
scope.toggleLock = function(){
scope.locked = !scope.locked;
if(scope.locked === false) {
autoFocusField();
}
};
function autoFocusField() {
// timeout to make sure dom has updated from a disabled field
$timeout(function() {
var input = element.children('.umb-locked-field__input');
input.focus();
});
}
}
};