My template looksI'm getting an error as follows,
template:
<input #input placeholder="Search" id="search">
<divCannot class="item"read *ngFor="letproperty item'filter' of data | searchPipe: inputundefined.value">
{{item}}
</div>
and i have component for SearchPipeComponent template:
@Pipe({
name: 'searchPipe',
pure: false
})
export class SearchPipe implements PipeTransform {
transform(data: any[], searchTerm: string): any[] {
searchTerm = searchTerm.toUpperCase();
return data.filter(item => {
return item.toUpperCase().indexOf(searchTerm) !== -1
});
}
}
<input #input placeholder="Search" id="search">
<div class="item" *ngFor="let item of data | searchPipe: input.value">
{{item}}
</div>
what isPipe code:
@Pipe({
name: 'searchPipe',
pure: false
})
export class SearchPipe implements PipeTransform {
transform(data: any[], searchTerm: string): any[] {
searchTerm = searchTerm.toUpperCase();
return data.filter(item => {
return item.toUpperCase().indexOf(searchTerm) !== -1
});
}
}
What causes the issue hereerror?