You should have a configuration file (ex. A JSON file) that contains the configurable parts of the uris. That file could then be directly included in the html (using server side templating) or retrieved dynamically with an ajax call back to the host your software runs on.
I've seen both used. On Wed, Aug 24, 2016, 08:35 Michael Davis <[email protected]> wrote: > Hi, > > I've inherited a PHP/Angular app. I've got lots of experience creating > Java web apps, but very little experience with Angular. > > Our Angular code makes $http calls to a server. The server URI is > hard-coded. I need to somehow be able to configure different URIs for dev, > prod, etc. > > This will be deployed as a Docker container, so ideally the solution would > involve environment variables, but I can't see an obvious way that that > would work for client-side javascript. Is there a best practice for this > kind of thing? > > Thanks in advance. > > -- > You received this message because you are subscribed to the Google Groups > "AngularJS" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/angular. > For more options, visit https://groups.google.com/d/optout. > -- Lucas Lacroix Computer Scientist Advanced Technology Division, MEDITECH <http://ehr.meditech.com/> 781-774-2293 -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
