← Angular learning pathAngular · Module 6 of 10
Routing
Navigate between pages with the Angular Router.
📖 Key ideas
- Define routes: { path: "about", component: AboutComponent }.
- <router-outlet> shows the active page.
- routerLink="/about" navigates without reload.
- Route params: path "users/:id", read via ActivatedRoute or input binding.
- Guards (canActivate) protect pages; lazy loading with loadComponent.
💡 Real-life example: The router is a TV remote: each channel number (URL) shows a different programme (component) on the same screen (outlet).
RoutesArray mapping paths to components
router-outletWhere the routed component appears
routerLinkNavigation directive
GuardDecides if a route can open