Angular CLI, Project Creation, Folder Structure
Angular 20 Project Folder Structure
my-angular-app/
├── src/
│ ├── app/
│ │ ├── app-routing.module.ts <-- Routing configuration
│ │ ├── app.component.ts <-- Root component logic
│ │ ├── app.component.html <-- Root component template
│ │ ├── app.component.css <-- Root component styling
│ │ └── app.module.ts <-- Main application module
│ │
│ ├── assets/ <-- Static assets (images, etc.)
│ ├── environments/ <-- Environment config (prod/dev)
│ │ ├── environment.ts
│ │ └── environment.prod.ts
│ │
│ ├── index.html <-- HTML entry point
│ ├── main.ts <-- Application entry point
│ ├── styles.css <-- Global styles
│ └── polyfills.ts <-- Legacy browser support
│
├── angular.json <-- Angular CLI configuration
├── package.json <-- npm dependencies & scripts
├── tsconfig.json <-- TypeScript configuration
└── README.md
📁 Root Folder (my-angular-app/)
This is the base folder of your Angular 20 project. It contains:
🔹 angular.json
-
Main configuration file for Angular CLI.
-
Controls build settings, file structure, styles, assets, environments, etc.
-
Example:
🔹 package.json
-
Lists all npm dependencies, scripts, and metadata.
-
Example:
🔹 tsconfig.json
-
TypeScript compiler configuration file.
-
Defines how TypeScript is compiled.
🔹 tsconfig.app.json, tsconfig.spec.json
-
Inherits from
tsconfig.jsonbut used specifically for:-
tsconfig.app.json→ App build -
tsconfig.spec.json→ Unit tests
-
🔹 node_modules/
-
Contains all third-party libraries your app depends on.
-
Auto-generated by
npm install.
📁 src/ — Your Application Source Code
📄 main.ts
-
Entry point of the application.
-
Bootstraps the root module (
AppModule).
📄 index.html
-
The main HTML file.
-
The Angular app is rendered inside the
<app-root></app-root>tag.
📄 styles.css
-
Global styles for the entire app.
-
You can change this to
.scssor.sassduring setup.
📄 polyfills.ts
-
Adds browser-specific support (like IE11 if needed).
-
Required for compatibility with older browsers.
📁 src/app/ — Application Logic Lives Here
This is the most important folder.
📄 app.module.ts
-
Root Angular NgModule.
-
Declares your components and imports other modules.
📄 app.component.ts
-
Root component.
-
First component loaded by Angular.
-
Selector:
<app-root>
📄 app.component.html
-
Template (view) for root component.
📄 app.component.css
-
Styles for the root component.
📄 app-routing.module.ts
-
Handles routing logic (e.g., navigation between pages).
-
Contains path-to-component mappings like:
📁 src/assets/
-
For static assets (images, fonts, JSON files, etc.)
-
Content here is served directly (not bundled).
📁 Example:
📁 src/environments/
-
Contains environment-specific configuration files.
-
Useful for switching between
devandprodenvironments.
📄 environment.ts (for development)
📄 environment.prod.ts (for production)
Here's a simple Angular 20 Data Binding example using a Learning Management System (LMS) scenario. We'll demonstrate:
-
Interpolation
-
Property Binding
-
Event Binding
-
Two-Way Binding

Comments
Post a Comment