I'm converting an existing app into Angular 2, and the client-side code gets its config from an API on the server (things like telemetry setup and URLs to other APIs). I have some services that depend on the URLs returned by that API to build the requests for data. How do I get the URLs into that service?
My initial plan was to make a new "configuration" service that will handle getting the data. But then (I believe) whenever you wanted to access a configuration property, you would have to "subscribe" to it to get the values out (at least, that's what I'm doing with the other services). I'd also have to figure out how to chain the responses, so once the data from the configuration service is returned, the data from the actual service requested fires.
To get around, I could call the configuration service in the App's constructor (so it would load the data the application's startup) and dump the data into a singleton. But then I'd need to make sure that things depend on the configuration data don't access the properties before their loaded.
Any suggestions for an approach I should take?