Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

116
Views
How to pass the filtered data which is returned from Custom Pipe to Child Component?

Parent Component

<app-search-bar (sender)="searchVideo($event)"></app-search-bar>

<ng-container *ngFor="let video of videos | search: query; let i=index;">
...
</ng-container>

<app-pagination (sender)="setStartEnd($event)"></app-pagination>

Custom Pipe

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

@Pipe({
  name: 'search'
})
export class SearchPipe implements PipeTransform {

  transform(value: any, args: any): any {
    if(!value){
      return null;
    }
    if(!args){
      return value;
    }
    args = args.toLowerCase();
    return value.filter((data: any) => {
      return JSON.stringify(data).toLowerCase().includes(args);
    })
  }

}

Child Component (app-pagination)

<div class="pagination" *ngIf="videos.length > 3">
...
</div>

I need to get the filtered data that returned by Custom Pipe so that with the help of that I can handle the number of pages in Pagination Component.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Possibly don't use a pipe in this case. Move that logic to the parent component and share the output with whatever components in the template need it

Or, you could also use the pipe twice (although to me its logic I'd have in the parent class, not a pipe)

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!