Problem Statement
How do you pass data from a parent component to a child component?
Explanation
Use the @Input() decorator on the child to declare an input property, then bind to it from the parent template. This keeps the data flow explicit and one-way into the child.
Code Solution
SolutionRead Only
// child.component.ts @Input() title!: string; // parent.component.html <app-child [title]="pageTitle"></app-child>
Practice Sets
This question appears in the following practice sets: