Q1. What are child routes in Angular?
Child routes allow you to nest routes within a parent route. They are defined using the children property. The parent component must have a to render child components. This creates hierarchical navigation, like a dashboard with tabs.
Q2. How do you define child routes?
Example:
const routes: Routes = [
{ path: ''dashboard'', component: DashboardComponent,
children: [
{ path: ''profile'', component: ProfileComponent },
{ path: ''settings'', component: SettingsComponent }
]
}
];
URLs become /dashboard/profile, /dashboard/settings.Q3. How do you navigate to child routes?
Q4. What is an empty path child route?
An empty path child route renders a default component when the parent path is matched. Example:
children: [
{ path: '''', component: OverviewComponent },
{ path: ''details'', component: DetailsComponent }
]
Visiting /dashboard shows OverviewComponent.Q5. How do you access parent route parameters from a child?
Inject ActivatedRoute and use parent property. Example:
this.route.parent.params.subscribe(params => { ... });
Or use paramMap on parent.