Pass environment variables to an Angular2 app?
<p>I need to pass the backend url to my Angular2 app, since production and dev servers are hosted on different locations.</p>

<p>I know I could store such things in an external config.json and load upon startup. This, however, seems like unnecessary extra call to server before the app can get started.</p>

<p>Alternatively, what I do now is I do create a single global variable, which I inject in gulp depending on build. My app isn't a lib that needs to be reusable I don't believe I should hit <em>unexpected</em> global name clashes. But it's not a good practice.</p>

<p>I wonder if there's a third, better solution?</p>