Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

ternary operator AEM

Avatar

Level 5

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>