Where to put custom classes or how to reuse backend code in multiple pages

I use some code in multiple pages, to store and retrive stuff from the local storage. I would like to create a class in order to wrap these function.
Where can I put it?
I’m using the last version of ionic.
Thank you

I recommend the usage of providers for that. You find a tutorial about providers (services) in an angular environment here:

i agree. i just ported my ionic1 app to ionic2, and moved all the data handling functions to a singleton provider that uses rest web services to manage data from a mongo db server.

this is what i used to learn how