Thuta Learning
Angular
ProjectsWeb Developmentအလယ်အလတ်

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

Angularသင်ခန်းစာ 4430 မိနစ်

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • Mini Project: Task Tracker (Part 1 - Setup & Structure) ရဲ့ core concept နဲ့ Angular data flow ကိုရှင်းပြနိုင်ရန်
  • နမူနာ UI ကို run၊ state/output ခန့်မှန်းပြီး edge/error cases စမ်းနိုင်ရန်
  • လက်တွေ့ project တွင် typed safe pattern နဲ့ common pitfalls ကိုခွဲသိနိုင်ရန်

ရိုးရိုးလေး ရှင်းပြမယ်

Mini Project: Task Tracker (Part 1 - Setup & Structure) ကို ရိုးရိုးလေးနားလည်မယ်

ဒီ project မှာ Angular CLI နဲ့ Task Tracker app တစ်ခုကို scratch ကနေ တည်ဆောက်သွားမှာဖြစ်ပါတယ်။ Component-based architecture, TypeScript interfaces နဲ့ routing setup တွေက Angular app တိုင်းရဲ့ foundation ဖြစ်တဲ့အတွက် ဒီ Part 1 မှာ folder structure, root component, task model interface နဲ့ list/detail route နှစ်ခုကို ပြင်ဆင်ထားမှာပါ။ Part 2 နဲ့ Part 3 တွေမှာ ဒီ structure ပေါ်မှာ feature တွေ ဆက်တည်ဆောက်သွားမှာမို့ ဒီအဆင့်ကို သေချာလုပ်ထားဖို့ အရေးကြီးပါတယ်။ Components, modules နဲ့ routing lesson တွေမှာ သင်ခဲ့တဲ့ concept တွေကို ဒီမှာ practical အနေနဲ့ ပေါင်းသုံးကြည့်ရမှာပါ။

Problem → Why → Solution

ပြဿနာ — ဘာကြောင့် ဒီ concept လိုတာလဲ

Array index ကို task ID အဖြစ်သုံးလျှင် delete/reorder နောက် detail route က task မှားကိုညွှန်းနိုင်ပါတယ်။

ဖြစ်လေ့ရှိတဲ့အမှား

Happy path တစ်ခုအောင်တာနဲ့ feature မှန်ပြီဟုယူဆခြင်းက empty, loading, error နဲ့ cleanup bugs များကိုလွတ်စေနိုင်ပါတယ်။

Core Concept — အလုပ်လုပ်ပုံကိုနားလည်မယ်

Task Tracker Part 1 မှာ feature boundary, domain model, routes နဲ့ component ownership ကိုအရင်တည်ဆောက်ပါတယ်။ Task ID ကိုstable ဖြစ်စေပြီး model မှာ title, completion နဲ့ optional metadata contract ရှင်းရပါမယ်။ Project structure က future forms, persistence နဲ့ tests ကိုထည့်နိုင်အောင် UI, data access နဲ့ domain behavior ကိုမရောသင့်ပါ။

Mental Model
  1. Project requirements
  2. Components + state + services
  3. စမ်းသပ်ပြီး UI

Mini Project: Task Tracker (Part 1 - Setup & Structure) ရဲ့ core concept နဲ့ Angular data flow ကိုရှင်းပြနိုင်ရန်

အဓိက Syntax / 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 မှာ feature boundary, domain model, routes နဲ့ component ownership ကိုအရင်တည်ဆောက်ပါတယ်။ Task ID ကိုstable ဖြစ်စေပြီး model မှာ title, completion နဲ့ optional metadata contract ရှင်းရပါမယ်။ Project structure က future forms, persistence နဲ့ tests ကိုထည့်နိုင်အောင် UI, data access နဲ့ domain behavior ကိုမရောသင့်ပါ။

Code ကို အဆင့်လိုက်ဖတ်မယ်

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

    ဒီ project မှာ Angular CLI နဲ့ Task Tracker app တစ်ခုကို scratch ကနေ တည်ဆောက်သွားမှာဖြစ်ပါတယ်။ Component-based architecture, TypeScript interfaces နဲ့ routing setup တွေက Angular app တိုင်းရဲ့ foundation ဖြစ်တဲ့အတွက် ဒီ Part 1 မှာ folder structure, root component, task model interface နဲ့ list/detail route နှစ်ခုကို ပြင်ဆင်ထားမှာပါ။ Part 2 နဲ့ Part 3 တွေမှာ ဒီ structure ပေါ်မှာ feature တွေ ဆက်တည်ဆောက်သွားမှာမို့ ဒီအဆင့်ကို သေချာလုပ်ထားဖို့ အရေးကြီးပါတယ်။ Components, modules နဲ့ routing lesson တွေမှာ သင်ခဲ့တဲ့ concept တွေကို ဒီမှာ practical အနေနဲ့ ပေါင်းသုံးကြည့်ရမှာပါ။

  2. Components + state + servicesimport { TaskListComponent } from './task-list/task-l...

    Task Tracker Part 1 မှာ feature boundary, domain model, routes နဲ့ component ownership ကိုအရင်တည်ဆောက်ပါတယ်။ Task ID ကိုstable ဖြစ်စေပြီး model မှာ title, completion နဲ့ optional metadata contract ရှင်းရပါမယ်။ Project structure က future forms, persistence နဲ့ tests ကိုထည့်နိုင်အောင် UI, data access နဲ့ domain behavior ကိုမရောသင့်ပါ။

  3. စမ်းသပ်ပြီး UIexport class AppRoutingModule { }

    CLI နဲ့ app တည်ဆောက်ပြီး task feature routes, typed Task model, list/detail components နဲ့ not-found route ထည့်ပါ။ Direct URL နဲ့ empty list ကိုစမ်းပါ။

Execution Flow
  1. Project requirements
  2. Components + state + services
  3. စမ်းသပ်ပြီး UI

Success

Mini Project: Task Tracker (Part 1 - Setup & Structure) ရဲ့ core concept နဲ့ Angular data flow ကိုရှင်းပြနိုင်ရန်

Failure

Array index ကို task ID အဖြစ်သုံးလျှင် delete/reorder နောက် detail route က task မှားကိုညွှန်းနိုင်ပါတယ်။

ခဏလေး ဒီလိုပဲ စဉ်းစားကြည့်

ဒီ project မှာ Angular CLI နဲ့ Task Tracker app တစ်ခုကို scratch ကနေ တည်ဆောက်သွားမှာဖြစ်ပါတယ်။ Component-based architecture, TypeScript interfaces နဲ့ routing setup တွေက Angular app တိုင်းရဲ့ foundation ဖြစ်တဲ့အတွက် ဒီ Part 1 မှာ folder structure, root component, task model interface နဲ့ list/detail route နှစ်ခုကို ပြင်ဆင်ထားမှာပါ။ Part 2 နဲ့ Part 3 တွေမှာ ဒီ structure ပေါ်မှာ feature တွေ ဆက်တည်ဆောက်သွားမှာမို့ ဒီအဆင့်ကို သေချာလုပ်ထားဖို့ အရေးကြီးပါတယ်။ Components, modules နဲ့ routing lesson တွေမှာ သင်ခဲ့တဲ့ concept တွေကို ဒီမှာ practical အနေနဲ့ ပေါင်းသုံးကြည့်ရမှာပါ။

လက်တွေ့ ဆောက်ကြည့်မယ်

Terminal မှာ `ng new task-tracker --routing --style=css` command သုံးပြီး project အသစ်တစ်ခု create လုပ်ပါ။ `src/app` အောက်မှာ `task.model.ts` file ဆောက်ပြီး `Task` interface (id, title, description, completed) ကို define လုပ်ပါ။ `TaskListComponent` နဲ့ `TaskDetailComponent` ဆိုတဲ့ component နှစ်ခု `ng generate component` နဲ့ ဆောက်ပြီး `app-routing.module.ts` မှာ path `''` ကို TaskListComponent ဆီ၊ path `task/:id` ကို TaskDetailComponent ဆီ route လုပ်ပါ။ AppComponent template ထဲမှာ `<router-outlet>` ထည့်ပြီး header title လေး ပြထားပါ။

Code နမူနာ

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
ng serve run ထားရင် root path '/' မှာ TaskListComponent (empty list) ပေါ်လာပြီး header title ကို browser မှာ တွေ့ရမှာဖြစ်သည်။

Real-world usage

လက်တွေ့ Project မှာ ဘယ်လိုသုံးမလဲ

CLI နဲ့ app တည်ဆောက်ပြီး task feature routes, typed Task model, list/detail components နဲ့ not-found route ထည့်ပါ။ Direct URL နဲ့ empty list ကိုစမ်းပါ။

Mini challenge

ကိုယ်တိုင်တည်ဆောက်ကြည့်ပါ

Mini Project: Task Tracker (Part 1 - Setup & Structure) နမူနာကို copy မလုပ်ဘဲ ကိုယ်တိုင်ပြန်ရေးပါ။ Normal state နှစ်ခု၊ edge case တစ်ခုနှင့် failure state တစ်ခုထည့်ပြီး expected UI နဲ့ state transition ကိုမ run မီရေးထားပါ။

  • Example ကို copy မလုပ်ဘဲ ပြန်ရေးပါ
  • Normal input နဲ့ edge case စမ်းပါ
  • Run မလုပ်မီ compiler/output result ကိုခန့်မှန်းပါ
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 { }

ရလဒ်: Mini Project: Task Tracker (Part 1 - Setup & Structure) ရဲ့ core concept နဲ့ Angular data flow ကိုရှင်းပြနိုင်ရန်

အရိပ်အမြွက် ကြည့်ရန်

CLI နဲ့ app တည်ဆောက်ပြီး task feature routes, typed Task model, list/detail components နဲ့ not-found route ထည့်ပါ။ Direct URL နဲ့ empty list ကိုစမ်းပါ။

Quick Quiz 1 / 3

Mini Project: Task Tracker (Part 1 - Setup & Structure) ရဲ့ အဓိကသဘောတရားက ဘာလဲ။

Quick Quiz 2 / 3

ဘယ်အမှားကို အရင်ဆုံးရှောင်သင့်လဲ။

Quick Quiz 3 / 3

Real project မှာ ဘယ်လိုအသုံးချသင့်လဲ။

ဒီသင်ခန်းစာမှာ မှတ်ထားရမယ့်အချက်များ

  • Project requirements → Components + state + services → စမ်းသပ်ပြီး UI
  • Task Tracker Part 1 မှာ feature boundary, domain model, routes နဲ့ component ownership ကိုအရင်တည်ဆောက်ပါတယ်။ Task ID ကိုstable ဖြစ်စေပြီး model မှာ title, completion နဲ့ optional metadata contract ရှင်းရပါမယ်။ Project structure က future forms, persistence နဲ့ tests ကိုထည့်နိုင်အောင် UI, data access နဲ့ domain behavior ကိုမရောသင့်ပါ။
  • Array index ကို task ID အဖြစ်သုံးလျှင် delete/reorder နောက် detail route က task မှားကိုညွှန်းနိုင်ပါတယ်။
  • CLI နဲ့ app တည်ဆောက်ပြီး task feature routes, typed Task model, list/detail components နဲ့ not-found route ထည့်ပါ။ Direct URL နဲ့ empty list ကိုစမ်းပါ။

Angular — Overview — Angular

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • Array index ကို task ID အဖြစ်သုံးလျှင် delete/reorder နောက် detail route က task မှားကိုညွှန်းနိုင်ပါတယ်။
  • Happy path တစ်ခုအောင်တာနဲ့ feature မှန်ပြီဟုယူဆခြင်းက empty, loading, error နဲ့ cleanup bugs များကိုလွတ်စေနိုင်ပါတယ်။

လက်တွေ့လေ့ကျင့်ခန်း

Mini Project: Task Tracker (Part 1 - Setup & Structure) နမူနာကို copy မလုပ်ဘဲ ကိုယ်တိုင်ပြန်ရေးပါ။ Normal state နှစ်ခု၊ edge case တစ်ခုနှင့် failure state တစ်ခုထည့်ပြီး expected UI နဲ့ state transition ကိုမ run မီရေးထားပါ။

အလုပ်ဖြစ်ကြောင်း ဒီလိုသိမယ်: ng serve run ထားရင် root path '/' မှာ TaskListComponent (empty list) ပေါ်လာပြီး header title ကို browser မှာ တွေ့ရမှာဖြစ်သည်။

နောက်ဆုံးပြင်ဆင်ရက်

Progress ကို ဤ browser (ဤစက်) တွင်သာ သိမ်းထားပါသည်။ အခြားစက်များနှင့် sync မလုပ်ပါ။

ဤသင်ခန်းစာတွင် အမှားတွေ့ပါက အကြောင်းကြားရန်သင့် email app ကို ဤသင်ခန်းစာလိပ်စာ ဖြည့်ပြီးသားဖြင့် ဖွင့်ပေးပါမည် — သင်ကိုယ်တိုင် ပို့မှသာ ပို့မည်ဖြစ်သည်။

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