How to pass object as component input in ngFor

In your parent component

<div *ngFor="let pollData of PollList ; let i index" >            
    <app-pollinfo [masterArray]="i"></app-pollinfo>
</div>

in your child component

@Input() masterArray : any;

use this and pass index then you will get data as object.


Your input syntax is not correct inside parent html. Do like this:

<div class="container">
  <app-soundcard *ngFor="let audio of audios" [soundBoardAudio]="audio"/>
</div>

Tags:

Angular