AngularJS directive that focuses the first empty input
###Basic
Inspects the input children of the form and focuses the first one that has no value
<ng-form name="myForm" focus-first-field>
</ng-form>
###Trigger
Define a condition that when true will cause the focus code to execute
angular.module('myApp')
.controller('myCtrl', function($scope, $timeout) {
$scope.myTrigger = false;
$timeout(function() {
$scope.myTrigger = true;
});
});
<ng-form name="myForm"
focus-first-field
focus-first-field-trigger="myTrigger">
</ng-form>
###Timeout Attempts
In the situation where the input fields are not available immediately (like generated by another directive), specify the number of timeouts (or digest cycles) it will take for those fields to be ready (defaults to 5 attempts)
<ng-form name="myForm"
focus-first-field
focus-first-field-timeout-attempts="2">
</ng-form>
Bower:
bower install angular-focus-field-field --save
See index.html