Added focus directive to focus textarea for a private message model box

This commit is contained in:
kholliday
2015-03-19 11:49:46 -05:00
parent c880c525b4
commit ceb2639f81
2 changed files with 16 additions and 3 deletions

View File

@@ -177,7 +177,7 @@ habitrpg
templateUrl: 'template/popover/popover-html.html'
};
}])
.directive( 'popoverHtml', [ '$compile', '$timeout', '$parse', '$window', '$tooltip',
.directive( 'popoverHtml', [ '$compile', '$timeout', '$parse', '$window', '$tooltip',
function ( $compile, $timeout, $parse, $window, $tooltip ) {
return $tooltip( 'popoverHtml', 'popover', 'click' );
}
@@ -193,3 +193,16 @@ habitrpg
" </div>\n" +
"</div>\n");
}]);
habitrpg.directive('focusMe', function($timeout, $parse) {
return {
link: function(scope, element, attrs) {
var model = $parse(attrs.focusMe);
scope.$watch(model, function(value) {
$timeout(function() {
element[0].focus();
});
});
}
};
});