NG.I · Angular 22 practice question
A developer is creating a component that extends a base component, which already defines an `@Output` property named `dataUpdated`. To ensure the derived component exposes this event under a different name, `payloadChange`, in its template, how should the `@Component` metadata be configured?
import { Component } from '@angular/core';
@Component({
selector: 'app-derived',
template: `...`,
outputs: ['dataUpdated: payloadChange']
})
export class DerivedComponent extends BaseComponent {} // BaseComponent has @Output() dataUpdated = new EventEmitter<any>()
Check answer and explanation
Correct answer: outputs: ['dataUpdated: payloadChange']
Explanation
The configuration 'outputs: ['dataUpdated: payloadChange']' correctly maps the inherited output 'dataUpdated' to a new alias 'payloadChange' when using the `outputs` property.
Common trap
Using 'outputs: ['payloadChange']' would only register the alias if the base class already defined an output with that name, which is not the case here. Simply listing 'dataUpdated' would use the original name.
Source: Angular docs: Custom events with outputs — Specify outputs in the `@Component` decorator
Checked against the cited text on 2026-11-25.