Reputation: 4756
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!
Upvotes: 7
Views: 13104
Reputation: 14375
{{ 'searchquery' | translate:false }}
{{ 'searchquery' | translate:'toUsEn' }}
Upvotes: 10