Environment
Angular has 2 built-in environments, but we can create our own environments.
Steps to create new environment
Before starting it is recommended to run
ng build --prod
This step is very useful to identify any error in our code in terms of imports of modules or dependency injections. This process uses whatevery we have configured in our angular.json file. it is not recommended to modify configurations related with the built-in environments. If we detect some problem when running the build, we want to fix it before creating any nre environment.
- Create a new ts file in our environment folder.
- Open angular.json file and create a new key value pair value in the configurations object. This key will be the name of our new environment.The value of this pair is going to be all our configurations for our new environment.
- Modify the key serve from angular.json we add a new entry with the new of our new environment.
- we can run the command ng serve -c=newEnv or ng build -c=newEnv to use our newly created environment file.
Top comments (0)