Pipes filter search not working, Am i missing something pls help


#1

Hi Folks,

I am trying to filter my search based the query into search bar, below is my code -

Error -

  • The pipe ‘piper’ could not be found

HTML -

<ion-item *ngFor="let post of contactsfound | piper: searchContacts")>
   <a style="border-radius: 50%;background: #43A047;" item-end ion-button icon-only>
     <ion-icon style="color:#fff" name='ios-call' is-active="false"></ion-icon>
     </a>
     <h2>{{post.displayName}}</h2>
     <p>{{post.phoneNumbers[0].value}}</p>
 </ion-item>

TS -

import { Component, Injectable, Pipe } from '@angular/core';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})

@Pipe({
	name: 'piper',
     pure: false
})
@Injectable()

Am i missing something pls help.


#2

Do you use lazy loading?

Have you imported the pipes.modules.ts in the page.module.ts?

Here is a exampel for the page.module.ts

import { NgModule } from "@angular/core";
import { IonicPageModule } from "ionic-angular";
import { ProfilePage } from "./profile";
import { PipesModule } from "../../pipes/pipes.module";

@NgModule({
  declarations: [ProfilePage],
  imports: [
    PipesModule,
    IonicPageModule.forChild(ProfilePage)
  ]
})
export class ProfilePageModule {}

#3

Don’t search by pipe. It’s terrible for your performance. Use a pipe for simple formatting only, like for currencies, dates, times.