Complete the code to import RouterModule with routes in an Angular standalone component.
import { RouterModule } from '@angular/router'; @Component({ standalone: true, imports: [[1]], template: `<router-outlet></router-outlet>` }) export class AppComponent {}
Use RouterModule.forRoot(routes) to configure the main application routes.
Complete the code to define a route path for the HomeComponent.
const routes = [
{ path: '', component: [1] }
];The empty path ('') usually points to the HomeComponent as the default page.
Fix the error in the route configuration to lazy load AdminModule.
const routes = [
{ path: 'admin', loadChildren: () => import('./admin/admin.module').[1] }
];The module class name is case sensitive and usually starts with a capital letter, so use AdminModule.
Fill both blanks to configure RouterModule with routes and enable initial navigation.
imports: [RouterModule.[1](routes, { [2]: 'enabled' })]
Use forRoot to set up routes and initialNavigation to enable navigation on app start.
Fill all three blanks to create a route with a parameter and a guard.
const routes = [
{ path: 'user/:id', component: UserComponent, canActivate: [[1]], data: { role: [2] } }
];
imports: [RouterModule.[3](routes)]The route uses AuthGuard to protect it, requires role 'admin', and is configured with forRoot.