ngFor to display object data

Viewed 1804

I'm trying to display all the .name and .info elements for actor and character objects shown below, using *ngFor. object

I create the object here in my resultpage.component:

this.actorInfo = [{actor: res.actorInfo, character: this.characters}];

and here is my html for running through the elements in resultpage.html:

<div class="castMembers">
  <div class="member" *ngFor="let item of actorInfo">
    <span class="character">{{item.name}}</span>
    <span class="actor">{{item.info}}</span>
  </div>
</div>

The above code does not output any errors, but it also does not output any information. I believe this is due to the first element on the object being 0:. But trying *ngFor="let item[0] of actorInfo" causes major problems in Angular.

How can I display all the name and info items in my object?

2 Answers
Related