I have an array of objects (list: any[]) that I use in an *ngFor expression. Is it possible to display one of the properties from the object when I know the property name at runtime?
I am creating a component, called ListComponent that displays a list of items. The parent component called ParentComponent, will pass in the array of objects and the property that it wants the ListComponent to display in the list.
Here is what I have so far in the ListComponent:
<div>
<div class="item" *ngFor="let item of itemList">{{item.name}}</div>
</div>
Instead of {{item.name}}, is it possible to make the .name part dynamic and use the property passed in by ParentComponent?