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

214
Views
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 answers
Answer question

0

{{ 'searchquery' | translate:false }}

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