How to get input from ion-searchbar?


It is super easy problem but I just can’t seem to figure this out (And yes I have read the documentation).

I am trying to get the input user puts in the ion-searchbar (in Ionic v4) after they the press search and put in a const/let.


<ion-searchbar showCancelButton="focus" class=""></ion-searchbar>

I don’t know how I should write the TS for this.

Thanks in advance :{)


  • Use (search) event to call your function. This event is fired when the user will click on the search button provided by the ion-searchbar.

  • To get the value entered in the searchbar, use $ which gets the value field of the tag which in this case is <ion-searchbar>

        placeholder="Search Some Values">

To listen to changes as user types in the search bar:


Answered By – Pankaj Sati

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published