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

216
Vistas
Angular 2 - Passing an argument to a custom pipe

I have a created a pipe which can receive 2 arugments, but I'm not sure how I can sent them.

here's my pipe:

export class TranslationPipe implements PipeTransform {

    private capitalize: boolean;

    constructor(
        private translationService: TranslationService
    ) {
        this.capitalize = true;
    }

    transform(key: string, capitalize?: boolean): string {
        if (typeof capitalize !== "undefined" || capitalize !== null)
            this.capitalize = capitalize;

        return this.translationService.getTranslation(key, this.capitalize);
    }
}

and here is my HTML

{{ 'searchquery' | translate }}

this works, but how can I pass capitlize = false aswell? I've tried some googling but I can't really find any example the way I want to implement it (maybe I'm doing it wrong?)

thanks for your help!

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

{{ 'searchquery' | translate:false }}

{{ 'searchquery' | translate:'toUsEn' }}
about 4 years ago · Santiago Trujillo 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