Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keyboard event with ionic form

I have an input field in my ionic form:

<input type="search" placeholder="Search" ng-model="searchKey">
<button class="button button-clear" ng-click="search()">Search</button>

And I wanna add an event that calls the function "search()" when I press enter button of my keyboard.

Is there any suggestion ?

Thank you in advance

like image 837
Fares Omrani Avatar asked May 01 '26 08:05

Fares Omrani


1 Answers

You can use this directive ng-enter, like this

<input type="search" placeholder="Search" ng-enter="search()" ng-model="searchKey">
like image 170
Oleksandr T. Avatar answered May 02 '26 21:05

Oleksandr T.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!