Thuta Learning
ရှာဖွေရန်
IntermediateWeb Developmentintermediate

Structural: *ngSwitch

စိတ်လျှော့ပါ။ ဒီခန်းကို စာအုပ်လိုမဟုတ်ဘဲ စကားပြောသလိုပဲ၊ နားလည်လွယ်အောင် ရှင်းပါမယ်။

*ngSwitch directive သည် multiple conditions များအတွက် အသုံးပြုသည် (JavaScript ၏ switch statement ကဲ့သို့)။

typescript
<div [ngSwitch]="userRole">
  <p *ngSwitchCase="'admin'">👑 Admin Dashboard</p>
  <p *ngSwitchCase="'editor'">✏️ Editor Panel</p>
  <p *ngSwitchCase="'viewer'">👀 Viewer Mode</p>
  <p *ngSwitchDefault>🔒 Access Denied</p>
</div>

// component.ts
export class MyComponent {
  userRole = 'editor';
}
You should see
(userRole သည် 'editor' ဖြစ်သောကြောင့် '✏️ Editor Panel' ဟု ပြသမည်)
Structural: *ngSwitch | Thuta Learning