
Angular Routing
Implement Angular route tables, guards, lazy loading, auth redirects, breadcrumbs, tabs, modals, and preloading without guessing Router API combinations.
Overview
Angular Routing is an agent skill for the Build phase that implements Angular Router configuration including guards, lazy loading, auth flows, breadcrumbs, modal routes, and preloading.
Install
npx skills add https://github.com/analogjs/angular-skills --skill angular-routingWhat is this skill?
- Full route option reference: guards, resolvers, outlets, pathMatch, dynamic title resolvers
- Authentication flow patterns with injectable Auth service and guard wiring
- Breadcrumbs, tab navigation, and modal route recipes
- Preloading strategies for faster navigations after initial load
- Table of contents covers six pattern areas including Route Configuration Options
- 6 documented pattern sections in table of contents
- Covers canActivate, canActivateChild, canDeactivate, and canMatch guards
Adoption & trust: 5.4k installs on skills.sh; 592 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need a maintainable Angular route map with auth, lazy chunks, and UX patterns like tabs and modals but keep mixing guard and resolver APIs.
Who is it for?
Indie developers on modern Angular who want agent help translating product navigation requirements into typed routes and guards.
Skip if: Non-Angular stacks, static marketing sites with no client router, or backend-only API design.
When should I use this skill?
Creating or refactoring Angular route configuration, authentication navigation, or advanced Router UX (breadcrumbs, tabs, modals, preloading).
What do I get? / Deliverables
You get consistent route definitions, guard/resolver services, and navigation UX patterns ready to merge into your Angular app.
- Route config arrays with guards, resolvers, and lazy imports
- Auth service and guard scaffolding aligned with routing flows
Recommended Skills
Journey fit
Routing configuration is core frontend build work before ship-time security review of auth guards and launch SEO for public URLs. Lazy loadComponent/loadChildren, canActivate/canMatch, and resolvers are day-one SPA architecture tasks in the frontend subphase.
How it compares
Angular-specific routing cookbook—not a generic React Router or Next.js app router skill.
Common Questions / FAQ
Who is angular-routing for?
Frontend-focused solo builders using Angular who need structured help for guards, lazy loading, and advanced navigation UX.
When should I use angular-routing?
Use in the build frontend subphase when scaffolding apps, adding auth-gated areas, or refactoring route trees before ship review.
Is angular-routing safe to install?
It supplies code patterns only; review the Security Audits panel on this page and ensure generated auth guards match your security model.
SKILL.md
READMESKILL.md - Angular Routing
# Angular Routing Patterns ## Table of Contents - [Route Configuration Options](#route-configuration-options) - [Authentication Flow](#authentication-flow) - [Breadcrumbs](#breadcrumbs) - [Tab Navigation](#tab-navigation) - [Modal Routes](#modal-routes) - [Preloading Strategies](#preloading-strategies) ## Route Configuration Options ### Full Route Options ```typescript { path: 'users/:id', component: UserCmpt, // Lazy loading alternatives loadComponent: () => import('./user.component').then(m => m.UserCmpt), loadChildren: () => import('./user.routes').then(m => m.userRoutes), // Guards canActivate: [authGuard], canActivateChild: [authGuard], canDeactivate: [unsavedChangesGuard], canMatch: [featureFlagGuard], // Data resolve: { user: userResolver }, data: { title: 'User Profile', animation: 'userPage' }, // Children children: [...], // Outlet outlet: 'sidebar', // Path matching pathMatch: 'full', // or 'prefix' // Title title: 'User Profile', // Or dynamic title title: userTitleResolver, } ``` ### Dynamic Title Resolver ```typescript export const userTitleResolver: ResolveFn<string> = (route) => { const userService = inject(User); const id = route.paramMap.get('id')!; return userService.getById(id).pipe( map(user => `${user.name} - Profile`) ); }; ``` ## Authentication Flow ### Complete Auth Setup ```typescript // auth.service.ts @Injectable({ providedIn: 'root' }) export class Auth { private _user = signal<User | null>(null); private _token = signal<string | null>(null); readonly user = this._user.asReadonly(); readonly isAuthenticated = computed(() => this._user() !== null); private router = inject(Router); private http = inject(HttpClient); async login(credentials: Credentials): Promise<boolean> { try { const response = await firstValueFrom( this.http.post<AuthResponse>('/api/login', credentials) ); this._token.set(response.token); this._user.set(response.user); localStorage.setItem('token', response.token); return true; } catch { return false; } } logout(): void { this._user.set(null); this._token.set(null); localStorage.removeItem('token'); this.router.navigate(['/login']); } async checkAuth(): Promise<boolean> { const token = localStorage.getItem('token'); if (!token) return false; try { const user = await firstValueFrom( this.http.get<User>('/api/me') ); this._user.set(user); this._token.set(token); return true; } catch { localStorage.removeItem('token'); return false; } } } // auth.guard.ts export const authGuard: CanActivateFn = async (route, state) => { const authService = inject(Auth); const router = inject(Router); // Check if already authenticated if (authService.isAuthenticated()) { return true; } // Try to restore session const isValid = await authService.checkAuth(); if (isValid) { return true; } // Redirect to login return router.createUrlTree(['/login'], { queryParams: { returnUrl: state.url }, }); }; // login.component.ts @Component({ template: ` <form (ngSubmit)="login()"> <input [(ngModel)]="email" name="email" /> <input [(ngModel)]="password" name="password" type="password" /> <button type="submit">Login</button> </form> `, }) export class Login { private authService = inject(Auth); private router = inject(Router); private route = inject(ActivatedRoute); email = ''; password = ''; async login() { const success = await this.authService.login({ email: this.email, password: this.password, }); if (success) { const returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/'; this.router.navigateByUrl(returnUrl); } } } ``` ## Breadcrumbs ```typescript // breadcrumb.service.ts @I