Home AngularJs Environment variables (API URL)
Reply: 0

AngularJs Environment variables (API URL)

user1079 Published in June 19, 2018, 2:33 pm

Recently I have been working with Angular5 using Angular Cli and one of the many things I like is the environment variables file located:


Here there are two files environment.prod.ts and environment.ts. One of mine looks like this:

// The file contents for the current environment will overwrite these during build.
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `.angular-cli.json`.

export const environment = {
  production: false,

  apiUrl: 'http://intel-api-interactivechoices.azurewebsites.net'
  //apiUrl: 'http://localhost:61006'  

I would like to use something similar in AngularJS but so far, I have been unable to find a suitable solution. Everything I try does not seem to do what I want.

Does anyone know of a way of achieving this?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.769575 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO