我有自定义管道并使用离子4
ERROR Error: Uncaught (in promise): Error: Template parse errors:
The pipe 'searchfilter' could not be found ("
</ul>
-->
<ion-card class="card-ios" *ngFor="let[ERROR ->] row of shopList | searchfilter : query">
<ion-item>
AppModule.ts
import { SearchfilterPipe } from './pipes/search/searchfilter.pipe';
@NgModule({declarations: [SearchfilterPipe])
Searchfilter.Pipe.ts
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'searchfilter'
})
export class SearchfilterPipe implements PipeTransform {
transform(value: any, query: string): any {
return null;
}
}
HTML
*ngFor="let row of shopList | searchfilter : query"
答案 0 :(得分:1)
您还需要在app.module.ts中导出管道。 像这样:
import { SearchfilterPipe } from './pipes/search/searchfilter.pipe';
@NgModule({
declarations: [SearchfilterPipe],
exports: [SearchfilterPipe]
)
我希望这会对您有所帮助。