skol-pro / ion-digit-keyboard-v2

A digital keyboard plugin to use in Ionic 2 applications.
MIT License
94 stars 40 forks source link

Feature Request (Keyboard Support For Web) #19

Open Tomwash opened 6 years ago

Tomwash commented 6 years ago

Hey I came across a use case for HostListener that would be an awesome addition to this project.

Not sure if it already exists somewhere and i missed it though. but here's the following code i'm using.

`import {HostListener} from '@angular/core';`
`
export class MyClass{
    @HostListener('window:keyup', ['$event'])
     onKeyup(event: any) {
           if(event.key === 'Backspace'){
                this.onKeyboardButtonClick('left');
           }
           if(Number(event.key) >= 0 && Number(event.key) <=9){
                this.onKeyboardButtonClick(event.key);
           }
     }
}
`