I don't know why this expression is not getting rendered. I am trying to append the css class based on status value on the TR.

                                <aura:iteration items="{!v.items}" var="item">
                                <tr class="(!item.Status} !='Active' ? 'css_red': 'net_css_green')">
                                    <td >
                                        <div class="slds-truncate" ><span>{!item.Name}</span></div>
                                    <td >
                                        <div class="slds-truncate" >{!item.Type}</div>

This is how it is rendered in browser. Instead of rendering the expression, whole code is append as class value. why?

This is the how it is coming in brower.

1 Answer 1


You missed the markup with brace.

<tr class="{!item.Status !='Active' ? 'css_red': 'net_css_green'}">
  • I did a silly mistake here, I didn't knew, this whole ternary operation should end with "}". I have few doubt, first, how is this rendered as JS or how?, second, does aura process it and generate html for such expression.
    – ntulsi
    Jan 17, 2018 at 15:12
  • @NaveenTulsi your mistake was that your expression should be enclosed in {! and }. Your expression should lie inside this "evaluator". "this whole ternary operation should end with '}'" is a wrong statement. Jan 18, 2018 at 11:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .