किसी सूची में टेक्स्ट इनपुट पर फ़ोकस सेट करने के लिए, निम्न कोड आज़माएँ:
newApp.directive('focus', function () {
return function (scope, element, attrs) {
attrs.$observe('focus', function (newValue) {
newValue === 'true' && element[0].focus();
});
}
}); निम्नलिखित एचटीएमएल है:
<input type="text" ng-model="cues[$index].text" focus="{{cue.isNewest}}"
class="input-xlarge" />{{cue.isNewest}}