[英]How to focus into an input box from PrimeNG autocomplete?
我想集中到inputbox
后PrimeNg autocomplete
onSelect
事件点击。
<p-autoComplete [(ngModel)]="itemIdAuto" name="itemIdAuto1" #itemIdAuto1="ngModel" size="15"
[suggestions]="filteredItemIdAutoSingle" (completeMethod)= "itemIdAutoComplete($event)" field="name"
(onSelect)="itemOnSelect(itemIdAuto)" placeholder= "Select Item Name" [minLength]="1"></p-autoComplete>
<input type="number" autocomplete="off" style="font-size:12px" class="form-control" name="qty"
[(ngModel)]="model.qty" #qty="ngModel">
打字稿:
import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
export class GridFormComponent implements OnInit {
constructor() {
}
ngOnInit() {
}
@ViewChild('aForm') aForm: ElementRef;
itemOnSelect(item) {
this.aForm.nativeElement['qty'].focus();
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.