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
Add a new presentational component for the event list by running the below command
2. Add @Input for Attendees to the new component
Add @Input for attendees being passed in from the parent component.
3. Add property binding to app-event-list component selector
Add
app-event-list
selector toEventComponent
template.Add property binding to pass into the child component the attendees.
4. ngFor the attendees on the the page
Use an Angular's
*ngFor
to add attendees to the component template by iterating over theattendees
array.
Run the app and add some attendees and they should be passed down and displayed by the EventListComponent.
StackBlitz Link
Last updated