我正在尝试按角度js模拟按Tab键按下。我想在角度的筹码中实现它。我做了一些研究,但找不到合适的答案。下面是示例代码。
HTML
<chips defer ng-model="item_titles_order.item_titles_orders.$selected_imei[$index]" render="batchesView.imeiValidation(data)" ng-keydown="batchesView.triggerEnter($event)" id = 'yourInput'>
<chip-tmpl>
<div class="default-chip ">
<span>{{chip.defer}}</span>
<i class="glyphicon glyphicon-remove" remove-chip style="margin: 0px;">
</i>
</div>
</chip-tmpl>
<input placeholder="Type/Scan IMEI" chip-control></input>
</chips>
控制器功能
vm.triggerEnter = function(keyEvent) {
if(keyEvent.keyCode==9){
var e = $.Event("keydown");
e.which = 13;
e.keyCode = 13;
$("#triggerEnter").trigger(e);
}
}