Menu
CoddyTech

Angular in Action

Part of the Fundamentals section of Coddy's Angular journey. Lesson 1 of 55.

An Angular component joins a template to a class. In this small gallery, the class owns a count and the template shows it. The supplied application is already complete: run the preview and try its button.

visits = signal(2);
// Template: <button (click)="visits.update(add)">{{visits()}}</button>
add = (n: number) => n + 1;

The excerpt below belongs inside a component. Calling a signal reads its current value; the click handler updates that value, and Angular refreshes the displayed text. You will build these pieces separately in the next chapters.

The editor uses Angular 20.3 with local dependencies. Press Run preview after editing source files to rebuild the preview. Clicking a button inside the running preview changes that app immediately; Check or Run code separately evaluates its requirements.

challenge icon

Challenge

Easy

Run the finished trail counter. The heading is Trail tracker. The count starts at 0; each Visit click adds one. Try two clicks and observe the display.

Explore the completed app. Press Run preview to refresh the preview after edits, then use Check or Run code to grade your work. Keep the requested element IDs.

Try it yourself

<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="stylesheet" href="styles.css"></head><body><app-root></app-root><script type="module" src="main.ts"></script></body></html>
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals