1
As a filter is applied to a *ngFor async, the *ngFor array comes from an Observable.
lotes$: Observable<Lote[]>;
*ngFor="let lote of (lotes$ | lancamentosFilter:searchText) | async; let i = index"
my filter, but it doesn’t work
import { Pipe, PipeTransform } from '@angular/core';
import { isArray } from 'util';
@Pipe({
name: 'lancamentosFilter',
pure: false
})
export class LancamentosFilter implements PipeTransform {
transform(items: any[], filter: any): any {
if(items !=null)
items.forEach(obs => (console.log(obs)));
if (!items || !filter || !isArray(items)) {
return items;
}
return items.filter(item => item.historico.indexOf(filter.historico) !== -1);
}
}