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.
- project requirements
- components, state, and services
- tested UI
Explain the core concept and Angular data flow of Mini Project: Task Tracker (Part 1 - Setup & Structure)
Core syntax or pattern
// 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
- project requirements
// src/app/task.model.tsIn 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.
- components, state, and services
import { 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.
- tested UI
export 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.
- project requirements
- components, state, and services
- 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
// 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 { }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
// 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
Quick quiz 2 / 3
Quick quiz 3 / 3
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