Signal Inputs with input()
Declare reactive inputs as signals.
Signal Inputs with input() is a free Angular Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Angular Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Signal-Based Inputs
Modern Angular provides the input() function to declare component inputs as signals, replacing the classic @Input decorator with a reactive alternative.
Declaring a Signal Input
Call input() with an optional default value. The result is a read-only signal.
import { Component, input } from "@angular/core";
@Component({ selector: "app-greet", template: "" })
export class GreetComponent {
name = input("World");
}Reading the Input
A signal input is read by calling it like a function, both in code and templates.
@Component({
selector: "app-greet",
template: "<p>Hello, {{ name() }}</p>"
})
export class GreetComponent {
name = input("World");
}Binding from the Parent
The parent binds to a signal input exactly like a classic input, using property binding.
<app-greet [name]="userName"></app-greet>
// parent
userName = "Ada";Inputs Are Read-Only
A plain input() is read-only inside the component. You cannot call set on it; only the parent changes its value.
// this is NOT allowed:
// this.name.set("x");
// inputs are read-only signalsTyping Inputs
Provide a generic type for type safety, especially when there is no default value to infer from.
age = input<number>();
label = input<string>("Untitled");Inputs in Computed Values
Because inputs are signals, they integrate with computed for derived state that updates automatically.
import { input, computed } from "@angular/core";
first = input("");
last = input("");
fullName = computed(() => this.first() + " " + this.last());Inputs with effect
You can react to input changes with effect, which re-runs whenever a read signal changes.
constructor() {
effect(() => {
console.log("name is", this.name());
});
}No ngOnChanges Needed
With signal inputs you often no longer need ngOnChanges; computed and effect react to changes for you.
Aliasing an Input
You can expose a different public binding name with the alias option.
value = input(0, { alias: "count" });
<!-- parent binds with the alias -->
<app-counter [count]="total"></app-counter>Why Signal Inputs
Signal inputs are reactive, type-safe, and compose cleanly with computed and effect, reducing boilerplate compared to the decorator plus lifecycle approach.
Quick Check
Test your understanding of signal inputs.
Recap
The input() function declares reactive, read-only signal inputs. Read them by calling them, type them with generics, alias them when needed, and combine with computed and effect instead of ngOnChanges.
Frequently asked questions
Is the “Signal Inputs with input()” lesson free?
Yes — the full text of “Signal Inputs with input()” is free to read here on the web, and the Angular Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Angular Academy course, upgrade to CoddyKit PRO.
What will I learn in “Signal Inputs with input()”?
Declare reactive inputs as signals. You practise Angular Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Angular Academy?
No prior experience is required. Angular Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Signal Inputs with input()” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Angular Academy lesson?
Yes. Every Angular Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Signal Inputs with input()
- Required and Transformed Inputs
- Outputs with output()
- View Queries with viewChild