Angular translate pipe in condition

Viewed 196

I am trying to make condition in template for translate, like this

{{showBigMap ? 'Shared.ShowMap' | translate : 'Shared.HideMap' | translate }}

But it does not compile, it got errors, my question is how I can use translate in condition in angular component template?

2 Answers
{{showBigMap ? ('Shared.ShowMap' | translate ): ('Shared.HideMap' | translate) }}

Wrap it in brackets

I advise you to write it in more readable way:

{{ (showBigMap ? 'Shared.ShowMap' : 'Shared.HideMap') | translate }}
Related