Angular · Junior · Question 25 of 75

How does a child component receive data from its parent?

export class UserCard {
  name = input.required<string>();
}
// parent: <app-user-card [name]="user.name" />

Explanation

input() returns a read-only signal, so in the template you read it as name(). input.required() makes the binding mandatory. The older equivalent is the @Input() decorator.

Further reading

Problem with a question

Angular · Junior · question 25

Test yourself

Take the Angular · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz