Expand my Community achievements bar.

SOLVED

ternary operator AEM

Avatar

Level 7

Hi Team, 

I want to print a value (which is getting from the dialog) inside a ternary operator.

 

I'm able to use ternary operator like below and it works fine.

<a href="#" class="${properties.openinnewwindow ? 'nonunderline' : ''}">link</a>

 

But when I put it like below it is not working. Adding a value from the dialog ${properties.name}.

<a href="#" class="${properties.openinnewwindow ? '${properties.name}' : ''}">link</a>

 

Any suggestions would be appreciated.

Thank you.

 

 @Vijayalakshmi_S 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @JakeCham,

Small correction in the usage. 

It should be 

<a href="#" class="${properties.openinnewwindow ? properties.name : 'Default class'}">link</a>

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi @JakeCham,

Small correction in the usage. 

It should be 

<a href="#" class="${properties.openinnewwindow ? properties.name : 'Default class'}">link</a>