Generally in the angular application by default, we have two environment
1) Development
2) Production Environment.
But In some cases, we need to add other environments for our application like QA and staging environment.
So let's see how we can add multiple environments in angular application for that we have to perform some steps.
Step 1:- Custom Environment File
- Here For every target environment, we have to create a new file under the environment folder here i have created two files evnironment.qa.ts and environment.staging.ts
Step 2:- Custom Environment Setting
- Here now you have to configure your environment name and new environment API URL and other settings
For Example:-
Step 3:- Need to Update the angular.json file
- Now in the angular project you can find the angular.json file. in that file, you have to configure your new environment like below
Here I have configure for QA environment
Step 4:- Build an Application For the new environment
- Now to build application with a new environment for that you have to run the below command in your terminal
ng build --configuration NEW_ENVIRONMENT_NAME
Examples: ng build --configuration qa
Comments
Post a Comment