Vodet
Vodet

Reputation: 1519

AngularJS correct syntax for variable in brace inside another brace

Hello I can't find the way for doing this correctly :

 {{point.localized ? "{{ 'CHECKED' | translate }}" :"{{ 'I_AM_HERE' | translate }}" }}

point.localized is a boolean and if it's true I want to display the translation for checked and if it's not the translation for I_AM_HERE how can I do this ?

Upvotes: 1

Views: 47

Answers (3)

Dario
Dario

Reputation: 6280

Try this:

{{point.localized ? ('CHECKED' | translate) : ('I_AM_HERE' | translate)  }}

Upvotes: 2

rrd
rrd

Reputation: 5977

Or the long way around, which is still valid:

<div ng-if="point.localized">
  <span>{{'CHECKED' | translate"}}</span>
</div>
<div ng-if="!point.localized">
  <span>{{'I AM HERE' | translate"}}</span>
</div>

Upvotes: 0

Slava.K
Slava.K

Reputation: 3080

What about this:

{{(point.localized ? 'CHECKED' : 'I_AM_HERE') | translate }}

Upvotes: 4

Related Questions