Bilal Maqsood
Bilal Maqsood

Reputation: 21

The pipe 'searchfilter' could not be found

I have custom Pipe and using ionic 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>
  1. AppModule.ts

    import { SearchfilterPipe } from './pipes/search/searchfilter.pipe';
    
    @NgModule({declarations: [SearchfilterPipe])
    
  2. 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;
        }
    
    }
    
  3. HTML

    *ngFor="let row of shopList | searchfilter : query"
    

Upvotes: 1

Views: 1269

Answers (1)

Vikram Jain
Vikram Jain

Reputation: 366

You also need to export your pipe in app.module.ts. like this:

import { SearchfilterPipe } from './pipes/search/searchfilter.pipe';

@NgModule({
    declarations: [SearchfilterPipe],
    exports: [SearchfilterPipe]
)

I hope this will help you.

Upvotes: 1

Related Questions