How to create global functions and variable through whole app?

Continuing the discussion from Global variables on ionic 2:
Hello ,everybody. I am new to Ionic and now I’m trying to make the global class(with variables and functions) which can be used through whole app.

I want this class can route to any pages and can provide its functions to routed pages.

But I am not sure how to make it.
It looks I can implement through provider , but I am not sure as I am a start in Ionic.
I want the advises of the professionals.
Thanks in advance.

Instead of using global variables. Use native ionic storage. You can access the values anywhere.

Thanks for your reply :slight_smile:
Can I access functions too?
What I want now is a whole class with variables and functions(like page navigation).

In that case you need to use providers.

1 Like

Thank you for your advice :grin:

Happy to help :grinning: