If you want to know more about Angular application, you can read our blog article about Akita state management pattern. Today, we will explain how to create a new environment with our own configuration and will answer the questions what are Angular Application environments? And how to add your own?
An Angular Application Environment is JSON configuration information that tells the build system which files to change when you use
ng build and
ng serve. This article is targeted at Angular 6 which really improved both the ease of use and the documentation for Application Environments.
In the tutorial you will go through:
1. Creating ng-configuration using Angular CLI
2. Learning using Angular configurations: replacing environment.ts file with the contents of the environment.prod.ts file
3. Building a simple environment example that shows how to switch between our default and production configurations
4. Modifying Configuration Information by updating the object with the name of the environment.
After that we can serve our application using the test environment:
ng serve --configuration=test
Use Angular Application Environments when you need a convenient way to manage configuration information for your applications and find the examples of code on every stage here, in the article by Todd Palmer