You need to sign in to do that
Don't have an account?
How to to get conditional rendering inside an iterator which is inside a scroller?
<!-- <ui:scrollerWrapper class="scroll" >--> <aura:iteration items="{!v.commentsData}" var="comment" indexVar="key"> <lightning:card class="{!comment.Color == 'grey' ? 'grey' : 'blue'}" aura:id="{!comment.Color}+{!key}"> {!comment.text} </lightning:card> </aura:iteration> <!-- </ui:scrollerWrapper>-->If ui:scrollerWrapper is uncommented, the class in card element does not work.
All Answers
rendered="{!if(condition,true,false)}"
attribute to the eliment you want to render on condition
I hope it will work for you,if you need further help tell me about your condition on which condition you want to render it.
It not a conditional rendering, it is conditional class attribution.
Line 3: class="{!comment.Color == 'grey' ? 'grey' : 'blue'}"
So the correct question would be:
How to to get conditional class attribution inside an iterator which is inside a scroller?
Adelchi Pelizzo,
use this code in Line 3:
class="{! if(comment.Color == 'grey','grey','blue') }"