Để đặt focus vào input text trong danh sách, thử mã sau:
newApp.directive('focus', function () { return function (scope, element, attrs) { attrs.$observe('focus', function (newValue) { newValue === 'true' && element[0].focus(); }); } });HTML:
<input type="text" ng-model="cues[$index].text" focus="{{cue.isNewest}}" class="input-xlarge" />{{cue.isNewest}}