How to do a settings page?

Hello,
I’d like to create a mobile application with different pages. One would be the settings page with for example the choice of the number of image to display on another page. Or the chois of the color of the background of another page. But I don’t know how I can do that, do have I to use txt files ?
Thanks by advance and sorry for my English

bump this i can the same problem

If someone has the same problem, I just found something, I can use the ionic storage to store my variables from my settings page and use it in another page. (https://ionicframework.com/docs/building/storage)
I hope it could help someone !

1 Like

Thank you, at least someone replied to this problem !

If you want to maintain state over multiple pages, you have two possibilities:

If your app is small, create a SettingsService. On initialization it should load it’s config from the Ionic Storage into a class property. I like to use a ReplaySubject for that, as all your pages can subscribe to value updates. On save it should update that property and persist it to the store.

If you have a larger app, you definitely should have a look at “central state management”. For Angular there’s the ngrx library you can use. For myself I’m using Apollo Angular for that, as I have a GraphQL-API as my backend.

1 Like