Auto selects all text in the header if it is still empty

This commit is contained in:
Shannon
2013-10-09 19:53:29 +11:00
parent f7c49758e1
commit ba7713fb93

View File

@@ -19,6 +19,8 @@ angular.module("umbraco.directives")
},
link: function(scope, element, attrs, ngModel) {
var inputElement = element.find("input");
ngModel.$render = function(){
$timeout(function(){
if(!scope.model){
@@ -29,8 +31,11 @@ angular.module("umbraco.directives")
scope.goEdit = function(){
scope.editMode = true;
$timeout(function(){
element.find("input").focus();
$timeout(function () {
inputElement.focus();
if (inputElement.val() === "Empty...") {
inputElement.select();
}
}, 100);
};