Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot read property 'toUpperCase' of undefined with the ERROR on *ngFor

Tags:

angular

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.

like image 751
Amaro Barros Avatar asked Apr 18 '17 14:04

Amaro Barros


1 Answers

It pipe should come before the index

<div class='text' *ngFor='let item of blogs | async | filter : 'feat' : true'; let i = index >
like image 98
Günter Zöchbauer Avatar answered Oct 13 '22 03:10

Günter Zöchbauer