I'm not sure if I'm even using the correct terminology, but here's what I'm trying to do.
I have a grid component:
export class GridComponent {
@Input()
items: any[];
}
In the HTML, I just have this:
<div class="grid">
<ul class="row">
<li *ngFor="let item of items; let i = index;" class="col-lg-3 col-sm-4 col-xs-6 card-container">
<ng-content></ng-content>
</li>
</ul>
</div>
So essentially, I'm going to pass in items (which could be anything depending on the app requirements), and the component will create a grid for me.
However, I still want the flexibility to construct whatever HTML I want for each iteration of the loop. So I'll need access to each "item" variable of the loop iteration.
I've searched around, and I've come across ngTemplateOutletContext
. But there are similar things being used as well. Not sure if I'm just getting confused, but I was hoping someone could give me a clear answer on how to solve this issue.