Event key Angular 2+
Angular 2+
@HostListener('window:keydown', ['$event']) keyboardInput(event: any) { event.preventDefault(); event.stopPropagation(); this.which = event.which; this.keyCode = event.keyCode; this.code = event.code; this.altKey = event.altKey; this.charCode = event.charCode; this.ctrlKey = event.ctrlKey; this.keyIdentifier = event.keyIdentifier; this.metaKey = event.metaKey; this.shiftKey = event.shiftKey; this.timeStamp = event.timeStamp; this.type = event.type; }
<input type="text" (keypress)="onlyNumber($event)" (keyup.enter)="enterKeyup($event)" (keyup.enter)="onChangeData($event)" (keydown.control.shift.enter)="onChangeData($event)" (blur)="onChangeData($event)" (focus)="onChangeData($event)" (click)="onChangeData($event)"/>
0 nhận xét:
Post a Comment