I'm looking to reuse a card component to display different types of data, but the @Input() properties are for different objects (articles and events).
Parent HTML:
<card-component [headline]="Articles"
[content]="articles">
</card-component>
<card-component [headline]="Events"
[content]="events">
</card-component>
Card Component TS:
@Input() headline!: string;
@Input() content!: Array<Article> | Array<Event>
Article object:
{
author: string,
blurb: string
}
Event object:
{
organizer: string,
location: string,
rsvpRequired: boolean
}
I think I need to create a new object in the card component ts file to standardize Article and Event into a single type, but I'm unsure of how to do this.