AngularJS: Empty - latest CI build
HTML
<script src="http://ci.angularjs.org/job/angular.js-angular-master/ws/build/angular.js"></script>
<a ng-click="add()">add</a>
<ul>
<li ng-repeat="i in items">{{i.name}} <input ng-model="i.description" init-focus></li>
</ul>
JavaScript
function Main($scope) {
$scope.items = [{
name: 'First',
description: 'Something...'
}, {
name: 'Second',
description: ''
}];
$scope.add = function() {
$scope.items.push({name: 'New'});
};
}
angular.module('fiddle', []).directive('initFocus', function() {
var timer;
return function(scope, elm, attr) {
if (timer) clearTimeout(timer);
timer = setTimeout(function() {
elm.focus();
console.log('focus', elm);
}, 0);
};
});