Reputation: 8999
Currently I am using angular and I have an array in typescript file like this.
var channelArray = {"channel1", "channel2", "channel3"}
In my html I have code like
<div *ngFor="let val of channelArray">
<de-series-prop></de-series-prop>
</div>
How do I pass the index of the array to series-prop component. I need the index value to assign some values in series-prop component.
Upvotes: 0
Views: 4399
Reputation: 1982
<div *ngFor="let val of channelArray; let i = index">
<de-series-prop [index]="i"></de-series-prop>
</div>
In your component:
@Input()
index: Number;
Upvotes: 1