Intermediate Tutorial

Take your Aurelia skills to the next level by building a feature-rich todo application. This tutorial covers component composition, filtering, local storage, and real-world patterns.

What You'll Learn

  • Creating multiple components and composing them

  • Component communication with bindable properties

  • Advanced list rendering and filtering

  • Form handling with validation

  • Local storage persistence

  • Computed properties and reactive updates

  • Template patterns for real apps

Prerequisites

The App We're Building

A todo application with:

  • ✅ Add, complete, and delete tasks

  • 🏷️ Categorize tasks (Work, Personal, Shopping)

  • 🔍 Filter by category and completion status

  • 💾 Auto-save to local storage

  • 📊 Task statistics

Step 1: Project Setup

Step 2: Data Models

Create src/models.ts:

Step 3: Storage Service

Create src/storage-service.ts:

The service is automatically registered as a singleton via DI.createInterface.

Step 4: Main App Component

Update src/my-app.ts:

Step 5: Create Todo Form Component

Create src/todo-form.ts:

Create src/todo-form.html:

Step 6: Create Todo Item Component

Create src/todo-item.ts:

Create src/todo-item.html:

Step 7: Main App Template

Update src/my-app.html:

Step 8: Styling

Update src/my-app.css:

What You've Learned

  • Component Composition - Created reusable TodoForm and TodoItem components

  • Component Communication - Used @bindable and .call for parent-child communication

  • Dependency Injection - Created and injected StorageService

  • Computed Properties - Implemented filtered lists and statistics

  • List Rendering - Used repeat.for with keys for efficient updates

  • Conditional Rendering - Showed/hid elements based on state

  • Form Handling - Built forms with validation and submission

  • Local Storage - Persisted data across sessions

  • Template Patterns - Applied real-world templating techniques

Next Steps

Enhance your app with:

  • Drag-and-drop reordering

  • Edit mode for todos

  • Due dates and reminders

  • Search functionality

  • Dark mode toggle

  • Export/import todos

Last updated

Was this helpful?