Miomir Dancevic
Miomir Dancevic

Reputation: 6852

Different translation based on value

I am trying to make some translation in Angular on translate pipe like this

 {{editableLinks ? 'Shared.Edit' : 'Shared.Details' | translate}}

But it does not works it always simple string like translate pipe is not bind? Any one got similar problem with translate pipe?

Upvotes: 1

Views: 316

Answers (1)

mat.hudak
mat.hudak

Reputation: 3203

Believe me or not, this should work:

{{(editableLinks ? 'Shared.Edit' : 'Shared.Details') | translate}}

Let the condition happen first and use resulting string as a translate key. Same applies when you use async

Upvotes: 3

Related Questions