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

Child Routes

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

Child Routes များသည် nested routing structure တစ်ခု တည်ဆောက်ရန် အသုံးပြုသည်။

typescript
// app-routing.module.ts
const routes: Routes = [
  {
    path: 'dashboard',
    component: DashboardComponent,
    children: [
      { path: '', redirectTo: 'overview', pathMatch: 'full' },
      { path: 'overview', component: OverviewComponent },
      { path: 'stats', component: StatsComponent },
      { path: 'settings', component: SettingsComponent }
    ]
  }
];

// dashboard.component.html
<div class="dashboard">
  <nav>
    <a routerLink="overview">Overview</a>
    <a routerLink="stats">Statistics</a>
    <a routerLink="settings">Settings</a>
  </nav>
  
  <!-- Child routes render here -->
  <router-outlet></router-outlet>
</div>
You should see
(/dashboard/overview, /dashboard/stats စသည်ဖြင့် nested routes များ အလုပ်လုပ်မည်)
Child Routes | Thuta Learning