Constants Config File in Angular 2

247 Views Asked by At

Is it possible to have a stand-alone XML or JSON config file for constant values within an angular 2 application? Reading online and the official angular documentation, here, recommends using a constants app config class within the app and then use dependency injection to access the constant values. My solution is looking to have a file that an admin could easily change the values for without having to rebuild the app each time the values change. The end goal is to have a constants config file either within or parallel to the angular app, but not be needed to rebuild the app each time it changes, and then access the constant values within the component typescript AND HTML markup for the components. Is this possible?

Thanks!

1

There are 1 best solutions below

1
On

Have you consider using indexDB or local storage (even cookies) for the user to change some properties.

By the way, it's not constant if users (or everything else) can change them.

Regards