Environmental Varialbes


#1

Hi,

I have been driving myself crazy trying to find the right solution to include IONIC_ENV into my project. I think its absurd that the framework does not include a well tested method to change and access process.env variables within the app. Does anyone know at least a proper method for implementing a way to access and change the process.env.IONIC_ENV and allow to access it within angular


#2

You can access any environment variable in your code with a simple webpack tweak. I wore a tutorial about it here: http://roblouie.com/article/296/ionic-2-environment-variables-the-best-way/

Note that I wrote this against ionic 2, if you are on a newer version you need to replace OpaqueToken with InjectionToken, but it should otherwise work.