I have a simple ngFor
loop which also keeps track of the current index
. I want to store that index
value in an attribute so I can print it. But I can't figure out how this works.
I basically have this:
<ul *ngFor="#item of items; #i = index" data-index="#i">
<li>{{item}}</li>
</ul>
I want to store the value of #i
in the attribute data-index
. I tried several methods but none of them worked.
I have a demo here: http://plnkr.co/edit/EXpOKAEIFlI9QwuRcZqp?p=preview
How can I store the index
value in the data-index
attribute?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…