I'm using the code from this answer Angular 2 - ngFor index after a pipe, but my problem now is that actually i get the items filtered but not the text itself, in my page i just see some empty divs. If select one of the items i can see in another div all the details of the selected item.
my pipe code:
@Pipe({
name: 'appFilter',
pure: false
})
export class AppFilterPipe implements PipeTransform {
transform(values: any[], arg1: any, arg2: any): any {
return values.reduce((acc, value, index) =>
value[arg1] == arg2 ? [...acc, { index, value }] : acc, []);
}
}
the html where the objects get filtered:
<div (click)="showComentario(fc.index);"
class="comentario"
*ngFor="let fc of comentarios | appFilter:'fav':1">
{{fc.comment}}
<div [ngClass]="setCss(fc.sentimient)"></div>
</div>
What is happening that i can't see the text of the filtered items?