Send data from a parent to a child component.
Parent
<!-- Parent HTML -->
<h1>About the Data</h1>
<child-selector [someSweetData]="'pretty sweet ngl'"></child-selector>
Child
// Child Component
import { Component, Input } from '@angular/core';
@Component({...})
export class ChildComponent {
@Input() someSweetData;
}
<!-- Child HTML -->
<p>The sweet data is {{ someSweetData }}!</p>
Send data from a child to a parent component.
Used to pull components from the template into the component. Link.
<!-- Template -->
// Component
You can also pull in plain HTML elements from the template into the component. You do this using template reference variables.
If you have a list of elements that all have the same reference variable.