9. Create EventListComponent
In this section we will make a EventList presentational component that will show how to use @Input() decorators and pass in data to a child component.
1. Add EventListComponent
ng g c event/components/event-list2. Add @Input for Attendees to the new component
import { Component, Input } from '@angular/core';
import { Attendee } from '../../../models';
@Component({
selector: 'app-event-list',
templateUrl: './event-list.component.html',
styleUrls: ['./event-list.component.scss']
})
export class EventListComponent {
@Input()
attendees: Attendee[];
}
3. Add property binding to app-event-list component selector
4. ngFor the attendees on the the page
StackBlitz Link
Last updated