(search) not getting fired in ion-searchbar


#1

I am having ion-search bar with type=“number” as

<ion-searchbar  (search)="search()"
  [(ngModel)]="input" type="number" showCancelButton="true" (ionBlur)="toggleSearchBar()" >
</ion-searchbar>

with enter search() should be called but it is not getting called.

If I put (change) in searchbar, then search() is being called when I click on cancel or clear all button on searchbar

If I put form around searchbar and put (submit)=“search()” in form tag, then during development I saw enter was working but in device it is not.

Any help?


#2

I solved it!

The button of enter or next in numeric keypad is Tab. So you can listen to this event::

(keydown.Tab)="yourFunction()"