0

There are two files by default in Environments environment.ts and environment.prod.ts in Angular.

I want to create new environment.qa.ts file and get configuration from them.

I am using Angular 9 with .net core 3.1.

Where to write code ? OR Do we need to change any code in startup.cs file ?

Post some code.

Any help Appericiated.

2
  • what do you mean by support?, you want to create a new configuration? Commented Mar 21, 2020 at 6:59
  • @cabesuon Yes.i want to create 3 different configuration Commented Mar 21, 2020 at 7:33

1 Answer 1

1

Just add the new environment file, in your case create environment.qa.ts in environment directory. Usually you can use environment.ts file as base file, and the modifications for the scenario.

After adding the new environment, you need to modify angular.json file accordingly. That will depend on what you want to achieve. Take a look that there is a configuration part in each architect command. For this, production configuration can guide you.

Sign up to request clarification or add additional context in comments.

7 Comments

Can you post some code,I tried chnaging in angular.json file but this may be work with angular cli but this is project of .net core with Angular so is anything to write in startup.cs file ?
It should not matter that is a core-net project, the angular project is a classic angular project. What are you trying to achieve with the new environment?.
I want to create different environments with my app like Dev,,qa,LAB,Prod. Appropriate key should take from different file for different environments.
Sorry I totally miss to follow this question .. I don't know if you solve it already .. My suggestion is to duplicate production environment to try .. For this duplicate file environment.prod.ts to environment.prod2.ts, and then do the same in angular.json , add the copy of production as production2 in the configuration section .. Then run ng build --configuration=production2 .. Let me know .. Sorry again for the delay respond
Thank you for your response. successfully I am able to run the project in different configuration. You need to set into three different configuration in .csproj file.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.