angular-router

Angular Router for navigation, routing configuration, route guards, lazy loading, and parameter handling. Use when setting up routes, implementing navigation guards, lazy loading modules, handling route parameters, or implementing breadcrumbs and nested routes in Angular applications.

16 stars

Best use case

angular-router is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Angular Router for navigation, routing configuration, route guards, lazy loading, and parameter handling. Use when setting up routes, implementing navigation guards, lazy loading modules, handling route parameters, or implementing breadcrumbs and nested routes in Angular applications.

Teams using angular-router should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/angular-router/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/frontend/angular-router/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/angular-router/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How angular-router Compares

Feature / Agentangular-routerStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Angular Router for navigation, routing configuration, route guards, lazy loading, and parameter handling. Use when setting up routes, implementing navigation guards, lazy loading modules, handling route parameters, or implementing breadcrumbs and nested routes in Angular applications.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Angular Router Skill

## Rules

### Router Configuration
- Use `provideRouter(routes)` in `app.config.ts` for standalone applications
- Define routes in a separate `routes.ts` file
- Use `pathMatch: 'full'` for empty path redirects
- Include wildcard route (`**`) as the LAST route for 404 handling

### Lazy Loading
- Use `loadChildren` for lazy loading feature routes
- Use `loadComponent` for lazy loading standalone components
- Do NOT eagerly import feature modules in route configuration

### Route Guards
- Use functional guards with `inject()` for dependency injection
- Return `boolean` or `UrlTree` from guards
- Use `router.createUrlTree(['/path'])` for guard redirects
- Do NOT use class-based guards (CanActivate, CanDeactivate interfaces)

### Route Parameters
- Use `toSignal(route.params, { initialValue })` to access route parameters
- Use `toSignal(route.queryParams, { initialValue })` to access query parameters
- Provide `initialValue` when converting route observables to signals
- Do NOT manually subscribe to `route.params` or `route.queryParams`

### Navigation
- Use `router.navigate(['/path'])` for programmatic navigation
- Use `[routerLink]="['/path']"` for template navigation
- Do NOT manipulate URLs directly via `window.location`

---

## Context

### When to Use This Skill

Activate this skill when you need to:
- Configure application routes
- Implement route guards (CanActivate, CanDeactivate, Resolve)
- Set up lazy loading for feature modules
- Handle route parameters and query parameters
- Implement nested and child routes
- Create navigation menus and breadcrumbs
- Handle route transitions and animations
- Implement route redirects and wildcards
- Work with router events and navigation lifecycle

### Basic Setup

```typescript
// app.routes.ts
import { Routes } from '@angular/router';

export const routes: Routes = [
  { path: '', redirectTo: '/home', pathMatch: 'full' },
  { path: 'home', component: HomeComponent },
  { path: 'about', component: AboutComponent },
  { path: '**', component: NotFoundComponent }
];

// app.config.ts
import { ApplicationConfig } from '@angular/core';
import { provideRouter } from '@angular/router';
import { routes } from './app.routes';

export const appConfig: ApplicationConfig = {
  providers: [
    provideRouter(routes)
  ]
};
```

### Lazy Loading

```typescript
// Feature module lazy loading
export const routes: Routes = [
  {
    path: 'admin',
    loadChildren: () => import('./admin/admin.routes')
      .then(m => m.ADMIN_ROUTES)
  },
  {
    path: 'workspace',
    loadComponent: () => import('./workspace/workspace.component')
      .then(m => m.WorkspaceComponent)
  }
];
```

### Route Guards

```typescript
// Auth guard
import { inject } from '@angular/core';
import { Router } from '@angular/router';
import { AuthService } from './auth.service';

export const authGuard = () => {
  const authService = inject(AuthService);
  const router = inject(Router);
  
  if (authService.isAuthenticated()) {
    return true;
  }
  
  return router.createUrlTree(['/login']);
};

// Apply guard
{
  path: 'dashboard',
  component: DashboardComponent,
  canActivate: [authGuard]
}
```

### Route Parameters

```typescript
// Route with parameter
{ path: 'user/:id', component: UserDetailComponent }

// Access in component
export class UserDetailComponent {
  private route = inject(ActivatedRoute);
  
  userId = toSignal(
    this.route.params.pipe(map(params => params['id'])),
    { initialValue: null }
  );
}
```

### References

- [Angular Router Documentation](https://angular.dev/guide/routing)
- [Router API Reference](https://angular.dev/api/router)

Related Skills

u0532-engineering-human-approval-router

16
from diegosouzapw/awesome-omni-skill

Operate the "Engineering Human Approval Router" capability in production for workflows. Use when mission execution explicitly requires this capability and outcomes must be reproducible, policy-gated, and handoff-ready.

solid-router-queries

16
from diegosouzapw/awesome-omni-skill

Solid Router queries: query() for data fetching with caching/deduplication, createAsync() for reactive signals, createAsyncStore() for fine-grained reactivity, query keys for revalidation.

solid-router-preloading

16
from diegosouzapw/awesome-omni-skill

Solid Router preloading: preload function for routes, usePreloadRoute hook, hover/focus intent detection, lazy component preloading, performance optimization.

Next.js App Router & Server Components

16
from diegosouzapw/awesome-omni-skill

Build Next.js 15 applications using App Router, Server Components, Client Components, Server Actions, and streaming. Apply when creating pages, handling data fetching, implementing routes, or optimizing performance.

frontend-angular-store

16
from diegosouzapw/awesome-omni-skill

Use when implementing state management with PlatformVmStore for complex components requiring reactive state, effects, and selectors.

frontend-angular-form

16
from diegosouzapw/awesome-omni-skill

Use when creating reactive forms with validation, async validators, dependent validation, and FormArrays using platform patterns.

frontend-angular-api-service

16
from diegosouzapw/awesome-omni-skill

Use when creating API services for backend communication with proper patterns for caching, error handling, and type safety.

app-router

16
from diegosouzapw/awesome-omni-skill

This skill should be used when the user asks to "create a Next.js route", "add a page", "set up layouts", "implement loading states", "add error boundaries", "organize routes", "create dynamic routes", or needs guidance on Next.js App Router file conventions and routing patterns.

angular

16
from diegosouzapw/awesome-omni-skill

Modern Angular (v20+) expert with deep knowledge of Signals, Standalone Components, Zoneless applications, SSR/Hydration, and reactive patterns.

angular-v21-development

16
from diegosouzapw/awesome-omni-skill

Develop Angular v21 components, services, and directives with signals. Use when implementing standalone components, OnPush change detection, inject() function, and input()/output() functions.

angular-v17

16
from diegosouzapw/awesome-omni-skill

Angular 17. Proyecto usa este skill; contenido canónico en .ai-system.

angular-typescript-cursorrules-prompt-file-cursorrules

16
from diegosouzapw/awesome-omni-skill

Apply for angular-typescript-cursorrules-prompt-file. --- description: General rules for Angular components, focusing on code quality, performance, and maintainability. globs: **/*.component.ts