Angular 22 · Routing and forms

Define routes

Map URLs to components, with a redirect and a wildcard.

export const routes: Routes = [
  { path: '', component: HomeComponent },
  { path: 'users/:id', component: UserComponent },
  { path: '**', component: NotFoundComponent },
];

Official Angular 22 documentation

More routing and forms commands

All routing and forms commands · Angular 22 cheatsheet

Was this page helpful?