Keypress event not getting fired

Hi,
In ionic 3 keypress not getting fired

<ion-searchbar (keypress)=“onKeypress($event)”
[(ngModel)]=“model.autoSearch” showCancelButton=“true”>

keypress event only fired in browser not getting fired in real device.

The keypress event is not available. Instead use ionInput to listen for input changes.

Try this out…

<ion-searchbar (ionInput)="onKeypress($event)"
[(ngModel)]=“model.autoSearch” showCancelButton=“true”>

Although, it really is “on input change” and not really “on key press”.

See Searchbar Output Event docs for more information.

Hope this help! :crossed_fingers:

Thanks for response. but I want charCode which is available in keypress event

<ion-searchbar (keypress)=“onKeypress($event)”
[(ngModel)]=“model.autoSearch” showCancelButton=“true”>

ts
onKeypress(event){
event.charCode();
}

it is working in browser but not working in android.

Did you find any solution? @ansarikhurshid786

Did you try with (keyup)