Community코딩 & 개발github.com

analogjs/angular-routing

Angular v20+ 애플리케이션에서 지연 로딩, 함수형 가드, 리졸버, 라우트 파라미터를 사용한 라우팅 구현. 네비게이션 설정, 보호된 라우트, 라우트 기반 데이터 로딩, 중첩 라우팅에 사용

angular-routing란 무엇인가요?

이 스킬은 Angular v20+ 애플리케이션에서 고급 라우팅 기능을 구현하는 데 사용됩니다. 주요 기능으로는 지연 로딩(lazy loading), 함수형 가드(functional guards), 리졸버(resolvers), 라우트 파라미터 처리 및 신호(signals) 기반 파라미터 읽기를 지원합니다. 개발자는 이 스킬을 통해 네비게이션 설정, 인증이 필요한 보호된 라우트, 라우트 기반 데이터 사전 로딩, 중첩 라우팅 구조를 손쉽게 구성할 수 있습니다. Cursor, Codex, Claude Code 등 주요 AI 코딩 에이전트와 호환되며, SKILL.md 문서에 정의된 대로 라우트 설정 추가, 가드 구현, 리졸버 연결, 지연 로딩 모듈 설정 등의 작업을 자동화합니다. Angular의 최신 라우팅 패턴과 신호 기반 반응성을 활용하여 성능과 코드 가독성을 높이는 데 초점을 맞추고 있습니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/analogjs/angular-skills/tree/main/skills/angular-routing

Installed? Explore more 코딩 & 개발 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

angular-routing은(는) 무엇을 하나요?

Angular v20+ 애플리케이션에서 지연 로딩, 함수형 가드, 리졸버, 라우트 파라미터를 사용한 라우팅을 구현합니다. 네비게이션 설정, 보호된 라우트 생성, 라우트 기반 데이터 로딩, 중첩 라우팅 구조에 사용됩니다. 다음 작업에서 트리거됩니다: 라우트 구성, 인증 가드 추가, 지연 로딩 구현, 신호(signals)를 사용한 라우트 파라미터 읽기.

주요 기능

  • 지연 로딩(Lazy Loading): loadComponent와 loadChildren을 사용하여 필요한 시점에 모듈과 컴포넌트를 로드
  • 함수형 가드(Functional Guards): 클래스 기반이 아닌 함수 형태의 canActivate, canMatch, canActivateChild 가드 지원
  • 리졸버(Resolvers): 라우트 진입 전 데이터를 미리 로드하는 함수형 리졸버
  • 라우트 파라미터: ActivatedRoute와 신호 기반 파라미터 처리
  • 중첩 라우팅: 자식 라우트와 함께하는 계층적 네비게이션 구조

사용 예시

기본 라우트 설정

import { Routes } from '@angular/router';
import { authGuard } from './guards/auth.guard';

export const routes: Routes = [
  {
    path: 'dashboard',
    loadComponent: () => import('./dashboard/dashboard.component'),
    canActivate: [authGuard],
    resolve: {
      userData: () => inject(UserService).getUserData(),
    },
  },
  {
    path: 'items',
    loadChildren: () => import('./items/items.routes'),
  },
];

함수형 가드 예시

import { inject } from '@angular/core';
import { CanActivateFn, Router } from '@angular/router';

export const authGuard: CanActivateFn = (route, state) => {
  const authService = inject(AuthService);
  const router = inject(Router);

  if (authService.isLoggedIn()) {
    return true;
  }

  return router.createUrlTree(['/login'], { queryParams: { returnUrl: state.url } });
};

신호로 라우트 파라미터 읽기

import { Component, inject } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { toSignal } from '@angular/core/rxjs-interop';
import { map } from 'rxjs';

@Component({
  template: `<h1>항목 {{ id() }}</h1>`,
})
export class ItemComponent {
  private route = inject(ActivatedRoute);
  id = toSignal(this.route.paramMap.pipe(map(params => params.get('id'))), { initialValue: '' });
}

관련 명령어

  • ng generate guard <name> — 새 가드 생성
  • ng generate resolver <name> — 새 리졸버 생성
  • ng generate module <name> --route <route> — 라우트로 모듈 생성

참고 자료

Individual skills in this repo

This repo contains 9 individual skills — each has its own dedicated page.

analogjs/angular-component

Create modern Angular standalone components following v20+ best practices. Use for building UI components with signal-based inputs/outputs, OnPush change detection, host bindings, content projection, and lifecycle hooks. Triggers on component creation, refactoring class-based inputs to signals, adding host bindings, or implementing accessible interactive components.

analogjs/angular-di

Implement dependency injection in Angular v20+ using inject(), injection tokens, and provider configuration. Use for service architecture, providing dependencies at different levels, creating injectable tokens, and managing singleton vs scoped services. Triggers on service creation, configuring providers, using injection tokens, or understanding DI hierarchy.

analogjs/angular-directives

Create custom directives in Angular v20+ for DOM manipulation and behavior extension. Use for attribute directives that modify element behavior/appearance, structural directives for portals/overlays, and host directives for composition. Triggers on creating reusable DOM behaviors, extending element functionality, or composing behaviors across components. Note - use native @if/@for/@switch for control flow, not custom structural directives.

analogjs/angular-forms

Build signal-based forms in Angular v21+ using the new Signal Forms API. Use for form creation with automatic two-way binding, schema-based validation, field state management, and dynamic forms. Triggers on form implementation, adding validation, creating multi-step forms, or building forms with conditional fields. Signal Forms are experimental but recommended for new Angular projects. Don't use for template-driven forms without signals or third-party form libraries like Formly or ngx-formly.

analogjs/angular-http

Implement HTTP data fetching in Angular v20+ using resource(), httpResource(), and HttpClient. Use for API calls, data loading with signals, request/response handling, and interceptors. Triggers on data fetching, API integration, loading states, error handling, or converting Observable-based HTTP to signal-based patterns.

analogjs/angular-signals

Implement signal-based reactive state management in Angular v20+. Use for creating reactive state with signal(), derived state with computed(), dependent state with linkedSignal(), and side effects with effect(). Triggers on state management questions, converting from BehaviorSubject/Observable patterns to signals, or implementing reactive data flows.

analogjs/angular-ssr

Implement server-side rendering and hydration in Angular v20+ using @angular/ssr. Use for SSR setup, hydration strategies, prerendering static pages, and handling browser-only APIs. Triggers on SSR configuration, fixing hydration mismatches, prerendering routes, or making code SSR-compatible.

analogjs/angular-testing

Write unit and integration tests for Angular v20+ applications using Vitest or Jasmine with TestBed and modern testing patterns. Use for testing components with signals, OnPush change detection, services with inject(), and HTTP interactions. Triggers on test creation, testing signal-based components, mocking dependencies, or setting up test infrastructure. Don't use for E2E testing with Cypress or Playwright, or for testing non-Angular JavaScript/TypeScript code.

analogjs/angular-tooling

Use Angular CLI and development tools effectively in Angular v20+ projects. Use for project setup, code generation, building, testing, and configuration. Triggers on creating new projects, generating components/services/modules, configuring builds, running tests, or optimizing production builds. Don't use for Nx workspace commands, custom Webpack configurations, or non-Angular CLI build systems like Vite standalone or esbuild direct usage.

관련 스킬