Let's say I have an array of objects that I'm looping through:
arr = [ {a: 1}, {a: 2}, {a: 1} ]
and I want to display the index of the object in my view, but I only want the index to increment if a condition is met. Something like a == 1. So if I had some code such as:
<!-- I know this won't work -->
<ul>
<li *ngFor="let obj of arr; let i = index">{{ i }}</li>
</ul>
...it would display as:
<li>0</li>
<li></li>
<li>1</li>