Angular using pipes and index in ngFor

Viewed 8170

Angular had many changes in the beta, my issue is that try to use pipes and the index in a ngFor and i get this message:

Parser Error: Unexpected token = and

The pipe 'let' could not be found  

when i use this code:

 <div style="overflow-y: scroll; max-height: 200px;">
        <div (click)="showComentario(index);" *ngFor="let comment of comentarios| filterSource:selectedSource | let index=index; ">
            {{comment.comment}}
        </div>
    </div>

if i change the order like this:

<div style="overflow-y: scroll; max-height: 200px;">
    <div (click)="showComentario(index);" *ngFor="let comment of comentarios;let index=index;| filterSource:selectedSource |  ">
        {{comment.comment}}
    </div>
</div>

i get this message:

Template parse errors:
TypeError: key[0] is undefined  



Parser Error: Unexpected token |, expected identifier, keyword, or string at column 47 in [let comment of comentarios; let index=index; 

How i can use pipes and index at the same time?

EDIT: I modified the code as the comments suggested like this:

<div style="overflow-y: scroll; max-height: 200px;">
    <div (click)="showComentario(index);" *ngFor="let comment of comentarios | filterSource:selectedSource;let index=index ">
        {{comment.comment}}
    </div>
</div>

i keep getting these errors: TypeError: key[0] is undefined and Parser Error: Unexpected token |

1 Answers
Related