Complete the code to define a child route inside the parent route.
const routes: Routes = [
{ path: 'parent', component: ParentComponent, children: [
{ path: [1], component: ChildComponent }
] }
];The child route path should be a string like 'child' to define the nested route under 'parent'.
Complete the code to import RouterModule with the routes in an Angular module.
@NgModule({
imports: [RouterModule.[1](routes)],
exports: [RouterModule]
})
export class AppRoutingModule {}Use forRoot to register the main routes in the root module.
Fix the error in the nested routes by completing the code correctly.
const routes: Routes = [
{ path: 'dashboard', component: DashboardComponent, [1]: [
{ path: 'stats', component: StatsComponent }
] }
];The correct property to define nested routes is children.
Fill both blanks to create a nested route with a default child route.
const routes: Routes = [
{ path: 'account', component: AccountComponent, children: [
{ path: [1], component: ProfileComponent },
{ path: [2], redirectTo: 'profile', pathMatch: 'full' }
] }
];The empty string '' defines the default child route path. The redirectTo points to 'profile' to load it by default.
Fill all three blanks to define nested routes with lazy loading and a child route.
const routes: Routes = [
{ path: 'settings', loadChildren: () => import('./settings/settings.module').[1](), children: [
{ path: [2], component: SettingsHomeComponent },
{ path: [3], component: SettingsDetailComponent }
] }
];Use then to resolve the module import promise. The default child route path is empty string '', and the other child route is 'detail'.