Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

use enter on keyboard to fire a function ionic3

Tags:

ionic2

I want to use the enter keyboard button on my phone to search for items. the red link has the filter function on it that I also want to fire when you press the enter/search button on your mobile device. how to do this?

enter image description here

like image 557
Sam van beastlo Avatar asked Mar 09 '23 06:03

Sam van beastlo


1 Answers

You can just use the (keyup.enter) to detect a Enter button press.

<ion-input type="text" (keyup.enter)="onEnter()"></ion-input>

and in your .ts file you can handle the event

onEnter(){
  //do search
}
like image 57
Sai Datta Avatar answered Mar 16 '23 03:03

Sai Datta