ternary operator AEM | Community
Skip to main content
JakeCham
September 10, 2021
Solved

ternary operator AEM

  • September 10, 2021
  • 1 reply
  • 1652 views

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 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Vijayalakshmi_S

Hi @jakecham,

Small correction in the usage. 

It should be 

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

1 reply

Vijayalakshmi_S
Vijayalakshmi_SAccepted solution
September 10, 2021

Hi @jakecham,

Small correction in the usage. 

It should be 

<a href="#" class="${properties.openinnewwindow ? properties.name : 'Default class'}">link</a>
JakeCham
JakeChamAuthor
September 10, 2021

Thanks a lot for the fast replying. Really appreciate it.