ရိုးရိုးလေး ရှင်းပြမယ်
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 ကိုမရောသင့်ပါ။
- Project requirements
- Components + state + services
- စမ်းသပ်ပြီး UI
Mini Project: Task Tracker (Part 1 - Setup & Structure) ရဲ့ core concept နဲ့ Angular data flow ကိုရှင်းပြနိုင်ရန်
အဓိက Syntax / 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 မှာ 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 ကို အဆင့်လိုက်ဖတ်မယ်
- 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 အနေနဲ့ ပေါင်းသုံးကြည့်ရမှာပါ။
- Components + state + services
import { 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 ကိုမရောသင့်ပါ။
- စမ်းသပ်ပြီး UI
export class AppRoutingModule { }CLI နဲ့ app တည်ဆောက်ပြီး task feature routes, typed Task model, list/detail components နဲ့ not-found route ထည့်ပါ။ Direct URL နဲ့ empty list ကိုစမ်းပါ။
- Project requirements
- Components + state + services
- စမ်းသပ်ပြီး 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 နမူနာ
// 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 { }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 ကိုခန့်မှန်းပါ
// 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
Quick Quiz 2 / 3
Quick Quiz 3 / 3
ဒီသင်ခန်းစာမှာ မှတ်ထားရမယ့်အချက်များ
- 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