input()

Declares a signal-based component input bound from the parent template.

Since Angular 17.1+ Spec ↗

Syntax

input<T>(defaultValue?, options?) | input.required<T>(options?)

Parameters

NameTypeRequiredDescription
defaultValue T No Value used when the parent does not bind the input.
options object No Supports alias and transform.

Returns

InputSignal<T> — A read-only signal carrying the current bound value.

Examples

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

@Component({
  selector: 'app-greet',
  standalone: true,
  template: `<p>Hello {{ name() }}</p>`,
})
export class GreetComponent {
  name = input('world');
  age = input.required<number>();
}
// parent template
// <app-greet [name]="user.name" [age]="user.age" />

Notes

input() replaces the @Input() decorator with a read-only signal you read by calling it. Use input.required() when a binding is mandatory; the value type excludes undefined. Provide a transform to coerce incoming values, and alias to expose a different binding name.