Setting editable Global Variable and Pipes in Ionic


#1

Hi

Is there an example on how to create a global variable in ionic 3?
I want to create a variable that could be used and changed by every page.
I am making an app that needed to allow users to switch between languages quickly from different page.
So I need a global variable that is can be edited and stored to whenever user changes it.

subsequently, I would also like to know how pipe works in Ionic3, if there’s an example for that?


#2

Look into using a provider of this issue. You would need to inject it on all your screens
As for Pipes, I refer you to the Angular.io’s Tour of Heroes tutorial for that.

You may also want to look at the ng-translate module that you can install

Chris