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" />- ✓Correct answer: Through an input declared with
input()and bound with[name]in the parent - 2By injecting the parent component and reading its fields
- 3Through a global variable
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.