Is there a way to dynamically decide on a CSS class in HTML using a ternary operator? I have tried the code below, but it seems like the condition is not being evaluated correctly. The class written in the true part of the condition always gets applied. How can I apply a specific class based on a certain condition? Any alternative approach would be greatly appreciated.
<td class="col-md-6"><span class="form-control-static cdr-details-td" />
<span class="(('1' === '-1') ? version-modal-header : failure)">{{cdr.causeCode}}</span>
</td>
CSS for the same:
.version-modal-header {
background-color: #000000;
}
.failure {
color: #ff0000;
font-weight: bold;
}