FRONTENDO
Emberhold Forge
0
0
Angular · Angular Routing
New technique

Pages without page loads

One great hall, many doors. The router decides which room you walk into: without rebuilding the hall.

An Angular app is a single-page application: the browser loads one page, and the router swaps components when the URL changes. No full reloads.

You describe the pages in a Routes array: each route maps a URL path to a component.

// app.routes.ts
import { Routes } from '@angular/router';

export const routes: Routes = [
  { path: '', component: Home },
  { path: 'halls', component: HallList },
];
  • path: '' is the home page (the empty path).
  • Paths are written without a leading slash: 'halls', not '/halls'.