Angular Academy · Lesson

Signal Inputs with input()

Declare reactive inputs as signals.

Lesson 1 of 413 steps

Signal Inputs with input() is a free Angular Academy lesson on CoddyKit. This is lesson 1 of 4. Any 3 lessons of this learning path are free to read in full — after that, CoddyKit PRO unlocks every lesson, plus hands-on practice with a built-in code editor and a 24/7 AI tutor. It is part of the Angular Academy learning path, and your progress syncs across the web and the CoddyKit app. The Angular Academy course includes 4 lessons in total.

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 signals

Typing 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.

Free to start

Learn HTML with an AI tutor — free

Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.

Courses
38
Lessons
144

Frequently Asked Questions

Is the “Signal Inputs with input()” lesson free?

Yes — any 3 lessons of the Angular Academy learning path, including “Signal Inputs with input()”, are free to read in full here on the web. After that, CoddyKit PRO unlocks every lesson, plus interactive practice with a built-in code editor and a 24/7 AI tutor. The Angular Academy course includes 4 lessons in total.

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, so you can start here or from the beginning and move at your own pace. This is lesson 1 of 4.

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

  1. Signal Inputs with input()
  2. Required and Transformed Inputs
  3. Outputs with output()
  4. View Queries with viewChild
← Back to Angular Academy