Skip to main content
⚡ OpenDevDocs
Angular
docsangularGuideIntermediate

Angular Router & Navigation

Configure routes, functional guards, lazy loading, and route parameters in Angular.

Verified: 2026-10-01
Tested on:angular 18.x
Platforms:
web
#angular#router#navigation

Angular Router & Navigation

The Angular Router enables client-side navigation with support for standalone routes, lazy-loaded child routes, and functional route guards.


Route Configuration (app.routes.ts)

import { Routes } from '@angular/router';
import { authGuard } from './guards/auth.guard';

export const routes: Routes = [
  {
    path: '',
    loadComponent: () => import('./home/home.component').then(m => m.HomeComponent)
  },
  {
    path: 'dashboard',
    canActivate: [authGuard],
    loadComponent: () => import('./dashboard/dashboard.component').then(m => m.DashboardComponent)
  },
  {
    path: 'products/:id',
    loadComponent: () => import('./product-detail/product-detail.component').then(m => m.ProductDetailComponent)
  },
  {
    path: '**',
    loadComponent: () => import('./not-found/not-found.component').then(m => m.NotFoundComponent)
  }
];

On this page