CORE ANGULAR • LESSON 8 OF 23

Component Communication

What you will learn

Pass data down, report events up, and keep shared ownership in the parent.

  • The modern input() API declares an input signal. input.required enforces that a parent supplies a value. The output() API exposes a typed event.
  • A child must not mutate an input object owned by its parent. Emit an intent with a stable record ID and let the owner update state.
  • Use model() for a component that intentionally supports two-way binding. Use input and output when the command flow should remain explicit.
  • Content projection with ng-content lets a caller supply markup without adding many presentation-specific inputs.

How it works

1Parent owns records
2input sends record down
3Child emits ID
4Parent updates selection

Expected result

Two cards appear. Selecting Asha or Ravi updates the parent-owned selected label.

Common mistakes

Do not mutate an input object. Do not use a service merely to communicate between a parent and its direct child. Give outputs event-oriented names.

Read the official Angular guide →