如何使用AngularJS和HTML5将焦点设置在列表中的文本输入上
若要将焦点放在列表中的文本输入上,请尝试以下代码:
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}}热门推荐
10 幼教专干调动祝福语简短
11 幼儿狗年祝福语大全简短
12 发小结婚简短祝福语
13 玫瑰礼盒祝福语大全简短
14 空军大学开学祝福语简短
15 八十大寿简短祝福语
16 文学短句祝福语大全简短
17 送去考试祝福语简短英文
18 情人表白祝福语简短大气