SearchBar, same search function for everypage

Hi everyone,

I have a search-bar present in 10 pages of my app.

<ion-content  shrink-header>

  <ion-searchbar></ion-searchbar> ...

I want to do a searchFunction, that will launch a new Page with the “SearchTerm” param => no pb for this.

But i dont want to write / copy this function in the 10 page where I need It …

What do you suggest me to use for this implementation ? Is it possible to use something like global function? Or should I encapsulate this in a component ? or something else ?

Thnaks for advice