InterviewHubPRO
Section Overview
Q206

Question 206 of 283

Part 8: Internationalization (i18n), Testing & DOM Directives (177 - 212)

73%
Angular & Signals (283 Qs)•Part 8: Internationalization (i18n), Testing & DOM Directives (177 - 212)

Is it possible to do aliasing for inputs and outputs?

Yes, it is possible to do aliasing for inputs and outputs in two ways.

  1. Aliasing in metadata: The inputs and outputs in the metadata aliased using a colon-delimited (:) string with the directive property name on the left and the public alias on the right. i.e. It will be in the format of propertyName:alias.
javascript
  inputs: ['input1: buyItem'],
  outputs: ['outputEvent1: completedEvent']
  1. Aliasing with @Input()/@Output() decorator: The alias can be specified for the property name by passing the alias name to the @Input()/@Output() decorator.i.e. It will be in the form of @Input(alias) or @Output(alias).
javascript
  @Input('buyItem') input1: string;
  @Output('completedEvent') outputEvent1 = new EventEmitter<string>();