angular-routing

Configure Angular v20+ routing with lazy loading, functional guards, resolvers, and signal-based route parameters.

Updated Jun 28, 2026
One-click install
npx skills add https://github.com/412181-HerediaLara/ScaffoldingBE-FE --skill angular-routing-412181-heredialara
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: angular-routing
Source: https://github.com/412181-HerediaLara/ScaffoldingBE-FE/tree/main/FE/.agents/skills/angular-routing
Command: npx skills add https://github.com/412181-HerediaLara/ScaffoldingBE-FE --skill angular-routing-412181-heredialara

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Setting up navigation in modern Angular applications requires coordinating route definitions, lazy loading, authentication guards, resolvers, and route parameter handling, which is error-prone when done from scratch. This Skill provides ready-to-use patterns for the complete Angular v20+ routing workflow. ## Core Features & Use Cases - Route Configuration: Set up basic routes, nested child routes, redirects, and wildcard 404 handling with provideRouter. - Lazy Loading: Load feature routes and standalone components on demand with loadChildren and loadComponent, plus preloading strategies. - Functional Guards & Resolvers: Protect routes with auth and role guards, prevent navigation away from unsaved forms, and pre-fetch data with ResolveFn. - Signal-Based Route Params: Bind route and query parameters directly to component inputs using withComponentInputBinding. - Use Case: You are building an admin dashboard that requires authentication, lazy-loaded feature areas, and user detail pages driven by URL parameters. Use this Skill to wire up the full routing structure with guards and resolvers in minutes. ## Quick Start Ask the AI to set up Angular routing for your app with a lazy-loaded admin section protected by an authentication guard.

Frequently Asked Questions about angular-routing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up lazy loading in Angular routes?

Use loadChildren to lazy load an entire feature route file or loadComponent for a single standalone component. Both accept a dynamic import, so the code is only fetched when the user navigates to that path.

How do I create an auth guard in Angular v20?

Write a CanActivateFn function that injects your auth service and Router, returns true when authenticated, or returns a UrlTree redirecting to the login page with a returnUrl query parameter. Attach it to routes via the canActivate array.

How do I read route parameters as signals in Angular?

Enable withComponentInputBinding() in provideRouter, then declare route params as input.required<string>() in your component. Angular automatically binds URL parameters and query params to matching component inputs.

Does Angular support preloading lazy-loaded routes?

Yes, pass withPreloading(PreloadAllModules) to provideRouter to preload all lazy routes, or implement a custom PreloadingStrategy to preload only routes marked with data.preload based on conditions like network speed.

How do I prevent navigation away from unsaved forms in Angular?

Implement a CanDeactivateFn guard that checks a canDeactivate method on your component, typically returning false when a form is dirty. Register it on the route with canDeactivate: [unsavedChangesGuard].

When should I use a resolver instead of loading data in the component?

Use a ResolveFn when the route should not activate until required data is available, such as a detail page that cannot render meaningfully without its entity. Resolved data is exposed to the component as an input when component input binding is enabled.