I've developed a custom pipe that can accept 2 arguments, but I'm unsure of how to pass them.
Here's the code for 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 the snippet from my HTML file:
{{ 'searchquery' | translate }}
The current setup works fine, but how can I also send capitlize = false
? I've tried searching online, but I couldn't find any examples that match my specific implementation (perhaps I'm missing something?)
Appreciate your assistance!