0

I have an angular application and it has some configuration parameters that it reads from a config file, the application loads and the configuration parameters are read and the app is ready to do its work.

Lets simplify and think there is only one parameter. I want to change that and instead of hard coding the parameter, i want to pass that parameter to the angular app at run time, when the application first gets loaded.

Any thoughts on how to do this?

reza
  • 5,972
  • 15
  • 84
  • 126
  • Do you want to set the parameter at build/deploy time, or at run time? Two very different things. – TimoStaudinger Mar 23 '17 at 21:38
  • Your question is almost identical (parameter vs config file) to another question, check my [answer](http://stackoverflow.com/a/42987447/1810391). – John Siu Mar 23 '17 at 21:41
  • @Timo run time really – reza Mar 23 '17 at 22:08
  • @JohnSiu Not seeing how your response replaces reading a config file with a runtime parameter to the angular app – reza Mar 23 '17 at 22:10
  • @reza Aren't you going to put that parameter in a config file? Or do you actually mean those `--production`, `--development` parameters? – John Siu Mar 23 '17 at 22:25
  • Possible duplicate of [How to pass parameters rendered from backend to angular2 bootstrap method](http://stackoverflow.com/questions/37611549/how-to-pass-parameters-rendered-from-backend-to-angular2-bootstrap-method) – Adnan A. Mar 23 '17 at 22:51
  • @JohnSiu, no config file, no build/deploy time parameters settings. Only at runtime – reza Mar 23 '17 at 23:00
  • Something like this? `npm start --prod` ? – John Siu Mar 23 '17 at 23:02

0 Answers0