Given the following Angular route configuration and component setup, what will be displayed inside the nested <router-outlet> when navigating to /dashboard/stats?
const routes = [ { path: 'dashboard', component: DashboardComponent, children: [ { path: 'stats', component: StatsComponent }, { path: 'reports', component: ReportsComponent } ]} ]; // DashboardComponent template: // <h1>Dashboard</h1> // <router-outlet></router-outlet>
Remember that child routes render inside the parent's <router-outlet>.
When navigating to /dashboard/stats, Angular renders DashboardComponent first, which includes a <router-outlet>. Inside this outlet, the StatsComponent is rendered because it matches the child route stats.
Which of the following Angular route configurations correctly defines a child route for profile under user?
Child routes must be inside the children array of the parent route and the parent must have a component.
Option C correctly nests the profile route inside the user route's children array and assigns components properly.
Option C incorrectly nests user inside profile.
Option C misses the parent component, which is required for child routes.
Option C separates routes without nesting, so profile is not a child route.
Consider this Angular route setup:
const routes = [
{ path: 'home', component: HomeComponent, children: [
{ path: 'details', component: DetailsComponent }
]}
];The HomeComponent template is:
<h2>Home</h2> <div>Welcome!</div>
When navigating to /home/details, the DetailsComponent does not appear. What is the most likely cause?
Child routes render inside the parent's <router-outlet>.
Without a <router-outlet> in HomeComponent, Angular has no place to render the child DetailsComponent. Adding <router-outlet> fixes this.
Given this Angular route configuration:
const routes = [
{ path: '', component: MainComponent, children: [
{ path: '', component: WelcomeComponent },
{ path: 'about', component: AboutComponent }
]}
];And the MainComponent template:
<nav> <a routerLink="">Welcome</a> <a routerLink="about">About</a> </nav> <router-outlet></router-outlet>
What will be the URL and displayed content after clicking the 'About' link?
Child routes render inside the parent's <router-outlet> and the parent component remains visible.
Clicking 'About' navigates to '/about'. The MainComponent stays rendered, and inside its <router-outlet>, the AboutComponent is displayed.
Choose the correct statement about Angular child routes and nested routing.
Think about how Angular renders nested routes inside parent components.
Option A is true: the parent component must have a <router-outlet> to display child routes.
Option A is false: route guards are not automatically inherited.
Option A is false: Angular supports multiple nested levels.
Option A is false: child routes render inside the parent, not replace it.