AI Hints
Home›Angular Tutorial›Parent and Child, input() and Required Inputs and Defaults
Angular · Lesson 46 of 120

Parent and Child

Components that talk.

⏱ 2 min read▶ Video at 55:12🎓 Free
Watch this lesson in the Angular courseWatch on YouTube ↗Full Angular course

A book list shows many book cards. The list is the parent, and each card is a child. They need to talk to each other.

  • A list and its cards
  • Parent and child
  • They need to talk

Data down, events up

The parent owns the data, like the list of books. It passes each book down to a child, through an input. When something happens in the child, like a click, the child sends an event up, through an output. And the parent decides what to do with it.

  1. Parent owns the data
  2. Data goes down: inputs
  3. Child shows it
  4. Events go up: outputs
  5. Parent reacts

Why this pattern

Children stay simple, and reusable. They just show what they're given, and report what happened. The data lives in one place, the parent. So it's always clear who changes what.

keyvalue
Childrenshow and report
Reusableanywhere, with any data
Datalives in one place
Clearwho changes what

Summary

Parents pass data down through inputs, and children send events up through outputs. Next, inputs.

Key takeaways
  • Data down
  • Events up
  • Parent owns the data
Next up: input() — data from the parent