I am currently upgrading to Grails 4. The use of ternary operators are not recognized in GSP pages. The following code:
<td>${(user?.active) ? '<i class="icon icon-plus" style="color: green;"></i> <span style="color: green">Active</span>' : '<i class="icon-remove-circle" style="color: red;"></i> <span style="color: red">Inactive</span>'}</td>
prints the string instead of the displaying the fontAwesome icon. If I remove the single quotes around the <i class = "icon... >
the following error is produced.
unexpected token: ? @ line 190, column 275, it) { return (user?.active) ? <i class
^
This was not a problem in the previous Grails version. Can anyone recommend a solution besides turning the line of code into an if-else statement?
Here is a screenshot of what is displayed.