If you chose a different path or name, then use your corresponding paths.
Now you should be able to import environment in every typescript file, and use the variables in there.
When you run it locally, it will use the variables from "src/environments/environment.ts".
And when you build this script (using 1 of the 2 builders), it will use the variables from "src/environments/environment.prod.ts",
standalone component generation
On default ng generate component myComponent will make it a standalone component. This is good for when you plan on making it exportable, but otherwise not so much.
You can change it so that it doesnāt make it standalone when you use ng generate component myComponent
You can either use ng generate component --standalone false myComponent, this will generate this one with your preferred standalone settings.
But if you want to change it as default mode, go to Angular.json and define the default behaviour:
The reason why you would want it to be standalone is for creating a component you want to export to other applications. But if you donāt need that, Iād advise to mkae it not be standalone.
Prevent issues by setting it to default in the init generation command: ng new --no-standalone appName
when I generate an angular app, I get the following question:
Do you want to enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering)?
I answer N on default, but I should investigate what it does.
Server-side rendering (SSR) is a process that involves rendering pages on the server, resulting in initial HTML content which contains initial page state. Once the HTML content is delivered to a browser, Angular initializes the application and utilizes the data contained within the HTML.
This page explains that it is not the best. And this page talks about problems with it when you combine it with Angular Material.
It is quite new at the moment that I am writing this (31st of January). That it is so new means that it probably still has a lot of bugs. Iād probably look at it again in angular 18 or 19+.
To create aĀ newĀ application with SSR, run:
ng new --ssr
To add SSR to anĀ existingĀ project, use the Angular CLIĀ ng addĀ command.