Angular Components
ASecurityDeclare a component output with `output<T>()` and emit values through its `.emit()` method. This replaces the decorator-based `@Output() EventEmitter<T>` pattern. ```ts import { ChangeDetectionStrategy, Component, input, output, } from '@angular/core'; interface SaveResult { id: string; } @Component({ selector: 'app-save-button', standalone: true, imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: ` <button type="button" (click)="save()"> Save </button> `, }) export class...
- 584 stars
- 0 votes
- 0 copies
- 2 views
- Added September 5, 2026
Works with
Security analysis
100/100Pro scans all 21 files and shows the line behind each finding
npx -y skills add HoangNguyen0403/agent-skills-standard --skill angular-components --agent claude-codeAre you the author of Angular Components?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/hoangnguyen0403-angular-components-c0b8b82b)# Using `output()` instead of `EventEmitter`
Declare a component output with `output<T>()` and emit values through its `.emit()` method. This replaces the decorator-based `@Output() EventEmitter<T>` pattern.
```ts
import {
ChangeDetectionStrategy,
Component,
input,
output,
} from '@angular/core';
interface SaveResult {
id: string;
}
@Component({
selector: 'app-save-button',
standalone: true,
imports: [],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<button type="button" (click)="save()">
Save
</button>
`,
})
export class SaveButtonComponent {
readonly id = input.required<string>();
readonly saved = output<SaveResult>();
save(): void {
this.saved.emit({ id: this.id() });
}
}
```
A parent listens to the output and receives the typed payload:
```html
<app-save-button [id]="documentId" (saved)="handleSaved($event)" />
```
Use `output<void>()` for an event with no payload. For two-way component state, use `model()` where appropriate. Outputs are for child-to-parent communication; the presentational child should not inject the service that persists the document.
Files in this skill
- eval-1.baseline.md
- eval-1.with-skill.md
- eval-2.baseline.md
- eval-2.with-skill.md
- eval-3.baseline.md
- eval-3.with-skill.md
- eval-4.baseline.md
- eval-4.with-skill.md
- eval-5.baseline.md
- eval-5.with-skill.md
- eval-6.baseline.md
- eval-6.with-skill.md
- eval-7.baseline.md
- eval-7.with-skill.md
- eval-8.baseline.md
- eval-8.with-skill.md
- eval-9.baseline.md
- eval-9.with-skill.md
- trigger-1.md
- trigger-2.md
Attribution
Related skills
View all in development →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.