Angular: focus checkbox
http://angularjs.org/
by mrajcok
HTML
<div ng-controller="MyCtrl">
<input type="checkbox" ng-model="focusCheckbox">
<input ng-model="name" focus>
</div>
JavaScript
var myApp = angular.module('myApp',[]);
myApp.directive('focus', function() {
return function(scope, element) {
scope.$watch('focusCheckbox',
function (newValue) {
newValue && element[0].focus()
})
}
});
function MyCtrl($scope) {}