Reputation: 53
I am trying to declare an index in *ngFor but I am getting a type error and it is saying
<div class='text' *ngFor='let item of blogs; let i = index | async | filter : 'feat' : true'>
If I take out let i = index
it works fine, but I want to use the index, so I can apply css classes to the elements. Looking at documentation, this is how you are supposed to do it.
Upvotes: 5
Views: 6761
Reputation: 658155
It pipe should come before the index
<div class='text' *ngFor='let item of blogs | async | filter : 'feat' : true'; let i = index >
Upvotes: 12