@Output

Declares an EventEmitter property as a component output event.

Since Angular 2+ Spec ↗

Syntax

@Output(alias?) propertyName = new EventEmitter<T>()

Parameters

NameTypeRequiredDescription
alias string No Optional public name for the emitted event.

Returns

PropertyDecorator — Decorator exposing the EventEmitter as an output.

Examples

import { Component, Output, EventEmitter } from '@angular/core';

@Component({
  selector: 'app-btn',
  standalone: true,
  template: `<button (click)="clicked.emit()">Go</button>`,
})
export class BtnComponent {
  @Output() clicked = new EventEmitter<void>();
}

Notes

The classic decorator API uses EventEmitter and emit(). New code should prefer the output() function, which needs no EventEmitter and handles teardown automatically. Bind in the parent with `(clicked)="..."`.