Add focus directive to be used to give input elements focus

This commit is contained in:
Andrew Hart 2014-10-21 16:42:40 -07:00
parent b8f624f1e0
commit beee5a3003

View File

@ -72,4 +72,20 @@ angular.module('insight')
});
}
};
})
.directive('focus', function ($timeout) {
return {
scope: {
trigger: '@focus'
},
link: function (scope, element) {
scope.$watch('trigger', function (value) {
if (value === "true") {
$timeout(function () {
element[0].focus();
});
}
});
}
};
});