Day 1 β Your First Angular 20 App (From Zero to Hero)
π Day 1 β Your First Angular 20 App (From Zero to Hero)
Welcome to Day 1 of your Angular From Zero to Hero series! Today, you will:
- βοΈ Install everything you need
- βοΈ Create your first Angular 20 app
- βοΈ Understand standalone components
- βοΈ Build and run your very first feature
- βοΈ Customize your app like a pro
This will be fun, hands-on, and practical β no fluff. Letβs build something real!
## π Step 1: Install Node.js (The Engine Behind Angular)
π Angular requires Node.js and npm. Download from the official website:
π https://nodejs.org/
βοΈ After installing, verify:
node -v
npm -v
If both print versions, youβre ready.
## π Step 2: Install Angular CLI
Angular CLI (Command Line Interface) gives you commands like ng serve, ng generate, etc.
Run:
npm install -g @angular/cli
Verify:
ng version
If you see Angular CLI 17/18/19/20 (anything modern), youβre good to go.
## π Step 3: Create Your First Angular 20 App
In your terminal:
ng new my-first-app --standalone
Angular will ask:
- βWould you like to add Angular routing?β
- π Choose Yes
- βWhich stylesheet format?β
- π Choose SCSS (recommended)
Wait a few seconds⦠and boom! You now have a real Angular project.
## π Step 4: Run the Application
Move into your project folder:
cd my-first-app
Start the dev server:
npm run start
or
ng serve -o
Your browser opens at:
π Congratulations β your Angular app is alive!
## π Step 5: Understanding the Project Structure
When you open the folder in VS Code, youβll see:
src/
ββ app/
β ββ app.component.ts
β ββ app.component.html
β ββ app.routes.ts
ββ assets/
ββ main.ts
ββ index.html
Letβs decode the important parts:
π§© main.ts
Bootstraps your Angular application using standalone components.
π§© app.component.ts
Your first Angular component.
π§© app.routes.ts
Routing configuration for your app.
π§© index.html
The single page Angular controls.
Youβre now in the Angular universe. π‘
## π Step 6: Modify Your First Component
Open: src/app/app.component.html
Replace everything with:
<h1>Welcome to My First Angular App π</h1>
<p>This is your first day of becoming an Angular Hero.</p>
<button (click)="increment()">Clicked {{ counter() }} times</button>
Now open: src/app/app.component.ts
Replace with this signal-based component:
import { Component, signal } from '@angular/core';
@Component({
selector: 'app-root',
standalone: true,
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
export class AppComponent {
counter = signal(0);
increment() {
this.counter.update(c => c + 1);
}
}
Refresh the browser β click the button β watch your counter grow βοΈ
π You just used Angular Signals on Day 1!
## π§ Step 7: What You Just Learned
Today you learned:
- βοΈ Installing Angular the correct way
- βοΈ Creating a Standalone Angular Application
- βοΈ Understanding Angularβs folder structure
- βοΈ Updating templates
- βοΈ Adding interactivity with signals
- βοΈ Running Angular locally
Youβre already ahead of most beginners.
## π§ͺ Step 8: Hands-On Challenge (Do This Now)
Create a new component called GreetingComponent:
-
Generate it:
ng generate component greeting --standalone -
Make it show:
Hello Angular! Today I feel: π
-
Add a button to toggle the emoji between π and π€
-
Import the component into
AppComponentand render it.