ลำดับของเส้นทางใน Angular

Angular ประมวลผลเส้นทางจากบนลงล่าง นั่นหมายความว่าควรวาง กรณีพิเศษของเส้นทางก่อน แล้วจึงตามด้วย กรณีทั่วไปมากขึ้น

ในตัวอย่างต่อไปนี้ เส้นทางแรกจะทำงานเสมอ:

app/app.component.tsconst appRoutes: Routes =[
  { path: '**', component: NotFoundComponent },
  { path: 'aaaa', component: AaaaComponent},
  { path: 'bbbb', component: BbbbComponent},
];
Задание 1

เปลี่ยนลำดับของเส้นทางในตัวอย่างให้เป็น ลำดับที่ถูกต้อง:

app/app.component.tsconst appRoutes: Routes =[
  { path: 'blog/:id', component: AaaaComponent},
  { path: 'blog/new', component: BbbbComponent},
];