Reputation: 470
I am trying to pass a variable from my spring boot controller to a heading with a ternary operator and nothing seems to work.
<h1 th:text="${createEntry} ? 'Create a new Entry:' : 'Edit Entry no. ${id}'"/></h1>
returns
Edit Entry no. ${id}
What is the correct syntax?
Upvotes: 0
Views: 1274
Reputation: 20487
<h1 th:text=${createEntry ? 'Create a new Entry:' : 'Edit Entry no. ' + id}" />
or
<h1 th:text="${createEntry} ? 'Create a new Entry:' : 'Edit Entry no. ' + ${id}"/>
Upvotes: 2