Rename task-focus focus-element

This commit is contained in:
Blade Barringer
2015-08-31 20:31:03 -05:00
parent d5bd5f281c
commit f4ca8bb78d
5 changed files with 11 additions and 11 deletions

View File

@@ -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();