Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

112
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda