What is Angular routing?

Answer

Angular Router enables navigation between views (components) in a SPA without full page reloads — updating the URL to reflect the current view while keeping the app state. Setup: import RouterModule.forRoot(routes) in AppModule with a routes array: const routes: Routes = [ { path: "", component: HomeComponent }, { path: "users", component: UsersComponent }, { path: "users/:id", component: UserDetailComponent }, { path: "admin", loadChildren: () => import("./admin/admin.module").then(m => m.AdminModule) }, { path: "**", component: NotFoundComponent } ];. Router outlet: <router-outlet></router-outlet> in the template — placeholder where routed components are rendered. Navigation: in templates: <a routerLink="/users/123" routerLinkActive="active">; programmatically: this.router.navigate(["/users", userId]); with query params: this.router.navigate(["/search"], { queryParams: { q: "angular" } }). Route parameters: read via ActivatedRoute: this.route.params.subscribe(params => { this.userId = params["id"]; }) or snapshot: this.route.snapshot.params["id"]. Child routes: nested routes within a parent component. Lazy loading: loadChildren defers loading the feature module until the route is first visited — improves initial load time. Guards: CanActivate, CanDeactivate, CanLoad protect routes.