Forum - store for settings
- This topic has 4 replies, 2 voices, and was last updated 1 week, 3 days ago by 49KOBV_FUB.
- October 15, 2020 at 10:14 am #6787449KOBV_FUBParticipant
I changed the settings in settings.ts, adding a new value and deleting an old one, but this change has no effect on the existing settings structure. Any idea what to do here?
-ChristophOctober 16, 2020 at 8:41 am #67892Josh WeismanKeymaster
Hi Christoph. Thanks for your question. Have you checked out the settings service tutorial? There are some code samples there that might be helpful.
If it still doesn’t work for you let us know.October 19, 2020 at 9:03 am #6795249KOBV_FUBParticipant
I use the code samples you mentioned obove. It works fine with the initial setting values in ./models/settings.ts. Changes in this class like adding a new value has no effect.
-ChristophOctober 19, 2020 at 11:43 am #67960Josh WeismanKeymaster
After you add new members to the Settings class, you should call the remove() method in the SettingsService to reset the saved value. Then the settings will be initialized as a new Settings class.
There are a number of approaches to how to changes to the settings contents after your app has been released and settings need to be updated/upgraded. For example, you could add values to the value or FormGroup returned from the SettingsService (see here for example), or you could create your own helper method which creates the FormGroup and adds default values as necessary (see this for example).
Hope this helps. Let us know how it goes.October 20, 2020 at 10:24 am #6796349KOBV_FUBParticipant
I think the problem is solved. I have to go to the display the app is concerning to, in my case to a PO-line, then the settings are changed as defined in ./models/setting.ts.
- You must be logged in to reply to this topic.