Thuta Learning
Angular
ProjectsWeb DevelopmentIntermediate

Mini Project: Task Tracker (Part 1 - Setup & Structure)

AngularLesson 4430 min

What you'll walk away with

  • Explain the core concept and Angular data flow of Mini Project: Task Tracker (Part 1 - Setup & Structure)
  • Run the example, predict its state and UI, and test edge and error cases
  • Apply a typed safe pattern in a real project and recognize common pitfalls

Explain it simply

Mini Project: Task Tracker (Part 1 - Setup & Structure), in plain language

In this project, we'll build a Task Tracker app from scratch using the Angular CLI. Component-based architecture, TypeScript interfaces, and routing setup are the foundation of every Angular app, so in Part 1 we'll prepare the folder structure, root component, task model interface, and two routes (list/detail). Since Part 2 and Part 3 will keep building features on top of this structure, it's important to get this stage right. Here we'll bring together, in a practical way, the concepts you learned in the components, modules, and routing lessons.

Problem → Why → Solution

The problem — why this concept matters

Using an array index as a task ID can point detail routes to the wrong task after deletion or reordering.

A common mistake

One happy-path result does not prove the feature works; empty, loading, error, and cleanup behavior need explicit tests.

Core concept — understand how it works

Task Tracker Part 1 establishes feature boundaries, the domain model, routes, and component ownership. Tasks need stable IDs and clear title, completion, and optional metadata contracts. Structure the project so later forms, persistence, and tests can be added without mixing UI, data access, and domain behavior.

Mental model
  1. project requirements
  2. components, state, and services
  3. tested UI

Explain the core concept and Angular data flow of Mini Project: Task Tracker (Part 1 - Setup & Structure)

Core syntax or pattern

typescript
// src/app/task.model.ts
export interface Task {
  id: number;
  title: string;
  description: string;
  completed: boolean;
}

// src/app/app-routing.module.ts
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { TaskListComponent } from './task-list/task-list.component';
import { TaskDetailComponent } from './task-detail/task-detail.component';

const routes: Routes = [
  { path: '', component: TaskListComponent },
  { path: 'task/:id', component: TaskDetailComponent }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }

Task Tracker Part 1 establishes feature boundaries, the domain model, routes, and component ownership. Tasks need stable IDs and clear title, completion, and optional metadata contracts. Structure the project so later forms, persistence, and tests can be added without mixing UI, data access, and domain behavior.

Read the code step by step

  1. project requirements// src/app/task.model.ts

    In this project, we'll build a Task Tracker app from scratch using the Angular CLI. Component-based architecture, TypeScript interfaces, and routing setup are the foundation of every Angular app, so in Part 1 we'll prepare the folder structure, root component, task model interface, and two routes (list/detail). Since Part 2 and Part 3 will keep building features on top of this structure, it's important to get this stage right. Here we'll bring together, in a practical way, the concepts you learned in the components, modules, and routing lessons.

  2. components, state, and servicesimport { TaskListComponent } from './task-list/task-l...

    Task Tracker Part 1 establishes feature boundaries, the domain model, routes, and component ownership. Tasks need stable IDs and clear title, completion, and optional metadata contracts. Structure the project so later forms, persistence, and tests can be added without mixing UI, data access, and domain behavior.

  3. tested UIexport class AppRoutingModule { }

    Create the app with the CLI and add task feature routes, a typed Task model, list and detail components, and a not-found route; test direct URLs and an empty list.

Execution flow
  1. project requirements
  2. components, state, and services
  3. tested UI

Success

Explain the core concept and Angular data flow of Mini Project: Task Tracker (Part 1 - Setup & Structure)

Failure

Using an array index as a task ID can point detail routes to the wrong task after deletion or reordering.

Let's think about this for a moment

In this project, we'll build a Task Tracker app from scratch using the Angular CLI. Component-based architecture, TypeScript interfaces, and routing setup are the foundation of every Angular app, so in Part 1 we'll prepare the folder structure, root component, task model interface, and two routes (list/detail). Since Part 2 and Part 3 will keep building features on top of this structure, it's important to get this stage right. Here we'll bring together, in a practical way, the concepts you learned in the components, modules, and routing lessons.

Let's build it for real

In the terminal, create a new project with `ng new task-tracker --routing --style=css`. Under `src/app`, create a `task.model.ts` file and define a `Task` interface (id, title, description, completed). Build two components, `TaskListComponent` and `TaskDetailComponent`, using `ng generate component`, then in `app-routing.module.ts` route path `''` to TaskListComponent and path `task/:id` to TaskDetailComponent. Add `<router-outlet>` in the AppComponent template and show a header title.

Code Example

typescript
// src/app/task.model.ts
export interface Task {
  id: number;
  title: string;
  description: string;
  completed: boolean;
}

// src/app/app-routing.module.ts
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { TaskListComponent } from './task-list/task-list.component';
import { TaskDetailComponent } from './task-detail/task-detail.component';

const routes: Routes = [
  { path: '', component: TaskListComponent },
  { path: 'task/:id', component: TaskDetailComponent }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
You should see
With ng serve running, the root path '/' shows TaskListComponent (empty list), and you'll see the header title in the browser.

Real-world usage

How to apply it in a real project

Create the app with the CLI and add task feature routes, a typed Task model, list and detail components, and a not-found route; test direct URLs and an empty list.

Mini challenge

Build it yourself

Rebuild the Mini Project: Task Tracker (Part 1 - Setup & Structure) example without copying it. Add two normal states, one edge case, and one failure state, and write the expected UI and state transition before running it.

  • Rebuild the example without copying it
  • Test a normal input and an edge case
  • Predict the compiler or output result before running it
typescript
// src/app/task.model.ts
export interface Task {
  id: number;
  title: string;
  description: string;
  completed: boolean;
}

// src/app/app-routing.module.ts
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { TaskListComponent } from './task-list/task-list.component';
import { TaskDetailComponent } from './task-detail/task-detail.component';

const routes: Routes = [
  { path: '', component: TaskListComponent },
  { path: 'task/:id', component: TaskDetailComponent }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }

Expected: Explain the core concept and Angular data flow of Mini Project: Task Tracker (Part 1 - Setup & Structure)

Show hint

Create the app with the CLI and add task feature routes, a typed Task model, list and detail components, and a not-found route; test direct URLs and an empty list.

Quick quiz 1 / 3

What best describes the core idea of Mini Project: Task Tracker (Part 1 - Setup & Structure)?

Quick quiz 2 / 3

Which mistake should you avoid first?

Quick quiz 3 / 3

How should this be applied in a real project?

What to remember

  • project requirements → components, state, and services → tested UI
  • Task Tracker Part 1 establishes feature boundaries, the domain model, routes, and component ownership. Tasks need stable IDs and clear title, completion, and optional metadata contracts. Structure the project so later forms, persistence, and tests can be added without mixing UI, data access, and domain behavior.
  • Using an array index as a task ID can point detail routes to the wrong task after deletion or reordering.
  • Create the app with the CLI and add task feature routes, a typed Task model, list and detail components, and a not-found route; test direct URLs and an empty list.

Angular — Overview — Angular

Easy traps

  • Using an array index as a task ID can point detail routes to the wrong task after deletion or reordering.
  • One happy-path result does not prove the feature works; empty, loading, error, and cleanup behavior need explicit tests.

Hands-on Exercise

Rebuild the Mini Project: Task Tracker (Part 1 - Setup & Structure) example without copying it. Add two normal states, one edge case, and one failure state, and write the expected UI and state transition before running it.

You'll know it worked when: With ng serve running, the root path '/' shows TaskListComponent (empty list), and you'll see the header title in the browser.

Updated on

Progress is saved only in this browser on this device. It isn't synced to other devices.

Report a problem with this lessonOpens your email app with this lesson's address filled in — nothing is sent until you send it.

Mini Project: Task Tracker (Part 1 - Setup & Structure) | Thuta Learning