Angular

Architecture &
Fine-Grained Signals

Angular is a comprehensive, production-grade web platform engineered by Google. Modern Angular combines the bedrock of TypeScript with fine-grained Signals, Standalone Components, and native template control flow.

00 / Setup

Getting Started

Angular provides a world-class Command Line Interface (CLI) that configures bundling, TypeScript, test runners, and development servers out of the box.

# 1. Install Angular CLI globally npm install -g @angular/cli # 2. Generate a new standalone application ng new undrstanding-angular --routing --style=css # 3. Start high-speed dev server via Vite cd undrstanding-angular ng serve

Angular 17+ uses esbuild and Vite under the hood, delivering near-instant builds.

01 / Building Blocks

Standalone Components

Components are the core foundation of Angular. In modern Angular, components are standalone by default. They explicitly declare their own template imports without cumbersome NgModule files.

The Code

import { Component } from '@angular/core'; @Component({ selector: 'app-button', standalone: true, template: `<button class="btn" (click)="handleClick()">{{ label }}</button>` }) export class ButtonComponent { label = 'Click me'; handleClick() { this.label = 'Clicked!'; } }

Components encapsulate markup, logic, and scoped styles in one self-contained unit.

The Result

Quick Check

True or False: Modern Angular components are standalone by default, requiring no NgModule declarations?

02 / Declarative UI

Templates & Data Binding

Angular templates extend standard HTML with clean syntax for data flow: interpolation, property binding, event listeners, and two-way synchronization.

{{ value }}

Interpolation: Embeds dynamic text expressions into the DOM.

[disabled]="isDisabled"

Property Binding: Passes values from the TypeScript class to DOM properties.

(click)="onSave()"

Event Binding: Listens for user interactions and invokes class methods.

[(ngModel)]="username"

Two-Way Binding ("Banana in a box"): Keeps property and UI synchronized bidirectionally.

03 / Reactivity

Signals & The Reactive Graph

Signals provide fine-grained reactivity. Unlike dirty-checking or coarse virtual DOM reconciliations, signals notify only the exact DOM nodes that depend on them, enabling zoneless high-performance rendering.

Interactive Reactive Calculation Graph

Live Signal Computation
$50
2
10%
subtotal() $100.00
discountVal() -$10.00
tax() (8%) $7.20
total() $97.20
const price = signal(50); const quantity = signal(2); const discount = signal(0.10); const subtotal = computed(() => price() * quantity()); const total = computed(() => (subtotal() * (1 - discount())) * 1.08);

Quick Check

Which reactive function produces a memoized, read-only derived value from other signals?

04 / Control Flow

Modern Template Control Flow

Angular replaced directive micro-syntax (*ngIf, *ngFor) with native block control flow. The syntax is faster, visually distinct, supports @empty blocks, and enforces mandatory tracking keys.

Control Flow Simulation

@if (user.isLoggedIn()) { ... } @else { ... }
Welcome back, Engineer
@for (task of tasks(); track task.id) { ... } @empty { ... }
  • Deploy Standalone App Done
  • Migrate to Signals In Progress

Quick Check

In modern template control flow, what expression is mandatory inside an @for block?

05 / Architecture

Modern Dependency Injection

Angular's hierarchical Dependency Injection (DI) system is one of its strongest features. Services can be configured once and injected anywhere using the modern, type-safe inject() function.

// 1. Define an Injectable Service @Injectable({ providedIn: 'root' }) export class UserService { currentUser = signal({ name: 'Ada Lovelace', role: 'Pioneer' }); } // 2. Inject cleanly into Standalone Component @Component({ selector: 'app-profile', standalone: true, template: `<h3>{{ user().name }} ({{ user().role }})</h3>` }) export class ProfileComponent { private userService = inject(UserService); user = this.userService.currentUser; }

The inject() function replaces boilerplate constructor injection and works in functions, factory providers, and route guards.

Quick Check

Can you use the inject() function inside functional routing guards?

06 / Navigation

Routing & Functional Guards

Angular's router supports declarative route definitions, instant lazy loading with dynamic imports, and lightweight functional guards.

export const routes: Routes = [ { path: 'dashboard', loadComponent: () => import('./dashboard.component').then(m => m.DashboardComponent), canActivate: [() => inject(AuthService).isAuthenticated()] } ];

loadComponent splits route bundles automatically without requiring dedicated routing modules.

07 / Data Entry

Reactive Forms & Validation

Reactive Forms manage user input with immutable data flows, synchronous validation pipelines, and deep testability.

export class RegisterComponent { form = new FormGroup({ email: new FormControl('', { validators: [Validators.required, Validators.email] }), terms: new FormControl(false, { validators: [Validators.requiredTrue] }) }); onSubmit() { if (this.form.valid) { console.log(this.form.value); } } }
08 / Performance

Deferrable Views (@defer)

Deferrable views allow you to defer loading heavy components until triggered by viewport entry, interaction, idle states, or timers.

@defer (on viewport) { <heavy-chart [data]="analyticsData()" /> } @placeholder { <div class="skeleton-chart">Chart placeholder...</div> } @loading (minimum 500ms) { <div class="spinner">Loading bundle...</div> } @error { <div class="error">Failed to load chart widget.</div> }
09 / Transformations

Pipes

Pipes format data directly inside template expressions without mutating underlying state. Built-in pipes include date, currency, and json.

// In Template: <p>Order Total: {{ total() | currency:'USD':'symbol':'1.2-2' }}</p> <p>Timestamp: {{ timestamp() | date:'medium' }}</p>
10 / Lexicon

Core Terminology

Signal
A reactive wrapper around a value that notifies interested consumers when that value changes.
Standalone Component
A self-contained component that declares its own imports directly without requiring an NgModule wrapper.
Dependency Injection (DI)
A design pattern in which dependencies are provided to an object rather than created by it directly.
Control Flow (@if, @for)
Modern template syntax replacing structural directives with native blocks for conditionals and loops.
Deferrable View (@defer)
A template feature that automatically splits and lazily loads designated component trees upon specified triggers.
11 / Assessment

Knowledge Check