Using code in multiple pages


#1

hi,
i want to use some code (autocomplete search bar) in few pages.
how tried providers and services as well. same problem:
i can’t use it outside the constructor.


#2

Can you turn it into a custom component?


#3

hi and thank you for the answer.
the ts i put already inside a service.
i mean the html - i have loop, list and few other things for the search bar.
is there a way put it one time outside somewhere and just call it?
in jquery it is pretty easy but in ionic i havn’t found a way yet…


#4

Yes, that is called a custom component in Angular speech. You put the HTML, CSS and JS all together in a few files that then can be imported and used in other components.