# Angular Modern Apis

> Guidelines for using modern Angular APIs (signals, inject, control flow)

- Skill: `mgechev/angular-modern-apis` (Agent Skill, multi-file: 5 files)
- Install (CLI): `npx skillmds@latest add mgechev/angular-modern-apis`
- Raw SKILL.md: https://api.skillmd.com/api/skills/mgechev/angular-modern-apis/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: mgechev (https://skillmd.com/u/mgechev)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/mgechev/angular-modern-apis

---


# Angular Modern APIs

This skill describes the mandatory coding standards for Angular components in our codebase.

## Rules

All Angular components must follow these rules:

1. **Use signal-based inputs** — Use `input()` and `output()` instead of `@Input()` and `@Output()` decorators
2. **Use `inject()` for DI** — Use `inject()` function instead of constructor parameter injection
3. **Use built-in control flow** — Use `@if`, `@for`, `@switch` instead of `*ngIf`, `*ngFor`, `*ngSwitch`

## Examples

### Signal inputs (correct)

```typescript
import { Component, input, output } from '@angular/core';

@Component({ ... })
export class UserProfileComponent {
  name = input.required<string>();
  age = input(0);
  saved = output<void>();
}
```

### inject() for DI (correct)

```typescript
import { Component, inject } from '@angular/core';
import { UserService } from './user.service';

@Component({ ... })
export class UserProfileComponent {
  private userService = inject(UserService);
}
```

### Built-in control flow (correct)

```html
@if (user()) {
  <h1>{{ user().name }}</h1>
} @else {
  <p>No user found</p>
}

@for (item of items(); track item.id) {
  <li>{{ item.name }}</li>
}
```

