Building for Different Environments

Learn how to build an Angular application for different environments using configuration parameters.

An organization may want to build an Angular application for multiple environments that require different variables, such as a backend API endpoint and application local settings. A common use case is a staging environment for testing the application before deploying it to production.

The Angular CLI enables us to define different configurations for each environment and build our application with each one. We can execute the ng build command (for a local machine) while passing the configuration name as a parameter using the following syntax:

Get hands-on with 1200+ tech skills courses.