ရိုးရိုးလေး ရှင်းပြမယ်
Get Started (CLI) ကို ရိုးရိုးလေးနားလည်မယ်
Angular project စရန် အလွယ်ဆုံးနည်းက Angular CLI ကိုသုံးခြင်းဖြစ်ပါတယ်။ CLI က project folder, build system, development server, component generate command စတာတွေကို တစ်ခါတည်းစီစဉ်ပေးတဲ့ tool ပါ။
Problem → Why → Solution
ပြဿနာ — ဘာကြောင့် ဒီ concept လိုတာလဲ
Global CLI version တစ်ခုတည်းကိုယုံပြီး lockfile မသိမ်းခြင်းက စက်မတူတဲ့အခါ build result ကွာစေနိုင်ပါတယ်။
ဖြစ်လေ့ရှိတဲ့အမှား
Happy path တစ်ခုအောင်တာနဲ့ feature မှန်ပြီဟုယူဆခြင်းက empty, loading, error နဲ့ cleanup bugs များကိုလွတ်စေနိုင်ပါတယ်။
Core Concept — အလုပ်လုပ်ပုံကိုနားလည်မယ်
Angular CLI က workspace configuration, build pipeline, development server, generators နဲ့ tests ကိုတစ်ပြိုင်နက်စီမံပေးပါတယ်။ Node.js, package manager နဲ့ Angular package versions တို့အချင်းချင်း compatible ဖြစ်ရပြီး `package.json`/lockfile က reproducible setup ရဲ့အခြေခံပါ။ `ng new` options တွေက routing, styles နဲ့ standalone structure ကိုအစကတည်းကသတ်မှတ်တာကြောင့် generated files ကိုနားလည်ပြီးမှ feature တိုးပါ။
- Input + state
- Component + template
- Rendered Angular UI
Get Started (CLI) ရဲ့ core concept နဲ့ Angular data flow ကိုရှင်းပြနိုင်ရန်
အဓိက Syntax / Pattern
# 1. Install Angular CLI globally
npm install -g @angular/cli
# 2. Create a new project
ng new my-angular-app
# 3. Navigate into the project directory and run
cd my-angular-app
ng serve --openAngular CLI က workspace configuration, build pipeline, development server, generators နဲ့ tests ကိုတစ်ပြိုင်နက်စီမံပေးပါတယ်။ Node.js, package manager နဲ့ Angular package versions တို့အချင်းချင်း compatible ဖြစ်ရပြီး `package.json`/lockfile က reproducible setup ရဲ့အခြေခံပါ။ `ng new` options တွေက routing, styles နဲ့ standalone structure ကိုအစကတည်းကသတ်မှတ်တာကြောင့် generated files ကိုနားလည်ပြီးမှ feature တိုးပါ။
Code ကို အဆင့်လိုက်ဖတ်မယ်
- Input + state
# 1. Install Angular CLI globallyAngular project စရန် အလွယ်ဆုံးနည်းက Angular CLI ကိုသုံးခြင်းဖြစ်ပါတယ်။ CLI က project folder, build system, development server, component generate command စတာတွေကို တစ်ခါတည်းစီစဉ်ပေးတဲ့ tool ပါ။
- Component + template
ng new my-angular-appAngular CLI က workspace configuration, build pipeline, development server, generators နဲ့ tests ကိုတစ်ပြိုင်နက်စီမံပေးပါတယ်။ Node.js, package manager နဲ့ Angular package versions တို့အချင်းချင်း compatible ဖြစ်ရပြီး `package.json`/lockfile က reproducible setup ရဲ့အခြေခံပါ။ `ng new` options တွေက routing, styles နဲ့ standalone structure ကိုအစကတည်းကသတ်မှတ်တာကြောင့် generated files ကိုနားလည်ပြီးမှ feature တိုးပါ။
- Rendered Angular UI
ng serve --openProject အသစ်တစ်ခုဖန်တီးပြီး `ng serve`, production build နဲ့ test command သုံးခု run ပါ။ `src/main.ts`, root component နဲ့ workspace config တို့ရဲ့တာဝန်ကိုမှတ်စုရေးပါ။
- Input + state
- Component + template
- Rendered Angular UI
Success
Get Started (CLI) ရဲ့ core concept နဲ့ Angular data flow ကိုရှင်းပြနိုင်ရန်
Failure
Global CLI version တစ်ခုတည်းကိုယုံပြီး lockfile မသိမ်းခြင်းက စက်မတူတဲ့အခါ build result ကွာစေနိုင်ပါတယ်။
Angular project စရန် အလွယ်ဆုံးနည်းက Angular CLI ကိုသုံးခြင်းဖြစ်ပါတယ်။ CLI က project folder, build system, development server, component generate command စတာတွေကို တစ်ခါတည်းစီစဉ်ပေးတဲ့ tool ပါ။
စတင်ရန်လိုအပ်တာများ
1. Node.js ကို install လုပ်ထားပါ။
2. Terminal / Command Prompt ဖွင့်ပါ။
3. Angular CLI install လုပ်ပါ။
4. Project အသစ်ဆောက်ပြီး local server run ပါ။
Command တွေကို run တဲ့အခါ error တက်ရင် Node version, internet connection, permission issue တွေကို အရင်စစ်ပါ။
# 1. Install Angular CLI globally
npm install -g @angular/cli
# 2. Create a new project
ng new my-angular-app
# 3. Navigate into the project directory and run
cd my-angular-app
ng serve --open(Terminal တွင် အထက်ပါ command များကို run ပြီးနောက် browser တွင် http://localhost:4200/ ဖြင့် Angular app ကို ဖွင့်ကြည့်နိုင်သည်)Real-world usage
လက်တွေ့ Project မှာ ဘယ်လိုသုံးမလဲ
Project အသစ်တစ်ခုဖန်တီးပြီး `ng serve`, production build နဲ့ test command သုံးခု run ပါ။ `src/main.ts`, root component နဲ့ workspace config တို့ရဲ့တာဝန်ကိုမှတ်စုရေးပါ။
Mini challenge
ကိုယ်တိုင်တည်ဆောက်ကြည့်ပါ
Get Started (CLI) နမူနာကို copy မလုပ်ဘဲ ကိုယ်တိုင်ပြန်ရေးပါ။ Normal state နှစ်ခု၊ edge case တစ်ခုနှင့် failure state တစ်ခုထည့်ပြီး expected UI နဲ့ state transition ကိုမ run မီရေးထားပါ။
- Example ကို copy မလုပ်ဘဲ ပြန်ရေးပါ
- Normal input နဲ့ edge case စမ်းပါ
- Run မလုပ်မီ compiler/output result ကိုခန့်မှန်းပါ
# 1. Install Angular CLI globally
npm install -g @angular/cli
# 2. Create a new project
ng new my-angular-app
# 3. Navigate into the project directory and run
cd my-angular-app
ng serve --openရလဒ်: Get Started (CLI) ရဲ့ core concept နဲ့ Angular data flow ကိုရှင်းပြနိုင်ရန်
အရိပ်အမြွက် ကြည့်ရန်
Project အသစ်တစ်ခုဖန်တီးပြီး `ng serve`, production build နဲ့ test command သုံးခု run ပါ။ `src/main.ts`, root component နဲ့ workspace config တို့ရဲ့တာဝန်ကိုမှတ်စုရေးပါ။
Quick Quiz 1 / 3
Quick Quiz 2 / 3
Quick Quiz 3 / 3
ဒီသင်ခန်းစာမှာ မှတ်ထားရမယ့်အချက်များ
- Input + state → Component + template → Rendered Angular UI
- Angular CLI က workspace configuration, build pipeline, development server, generators နဲ့ tests ကိုတစ်ပြိုင်နက်စီမံပေးပါတယ်။ Node.js, package manager နဲ့ Angular package versions တို့အချင်းချင်း compatible ဖြစ်ရပြီး `package.json`/lockfile က reproducible setup ရဲ့အခြေခံပါ။ `ng new` options တွေက routing, styles နဲ့ standalone structure ကိုအစကတည်းကသတ်မှတ်တာကြောင့် generated files ကိုနားလည်ပြီးမှ feature တိုးပါ။
- Global CLI version တစ်ခုတည်းကိုယုံပြီး lockfile မသိမ်းခြင်းက စက်မတူတဲ့အခါ build result ကွာစေနိုင်ပါတယ်။
- Project အသစ်တစ်ခုဖန်တီးပြီး `ng serve`, production build နဲ့ test command သုံးခု run ပါ။ `src/main.ts`, root component နဲ့ workspace config တို့ရဲ့တာဝန်ကိုမှတ်စုရေးပါ။
Angular — Installation — Angular