user1712638
user1712638

Reputation: 317

Concatenate another string to the translation result in angular template using translate pipe

I'm trying to have a title in my template that is a concatenation between 2 different strings, 1 would be a translation result, the other would be a variable that I have in may component

Nothing really makes sense to do this in a single tag, but I'm sure it have a workaround some were

<h4 class="value">{{'master.' + translationTitleVar | translate }}+ ": " + var2 </h4>

What is expected is when I have the translationTitleVar = "x2" and var2 = "world" and the translation key master.x2 = hello, I should get hello: world, but what I get is Hello: var2, which makes sense, how can I get it to print out hello: world

TIA mates

Upvotes: 0

Views: 4739

Answers (1)

Morphyish
Morphyish

Reputation: 4072

You just need to use the {{}} for the dynamic part of the template, everything else is regular html

<h4 class="value">{{'master.' + translationTitleVar | translate }}: {{var2}}</h4>

Upvotes: 2

Related Questions