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},
];