How to use conditional statements IF, Else in lightning components?.
In the above screen shot I am using aura:attribute to define variable with name as “change”, data type as boolean for this I assigned a default value as TRUE.
In line number seven I am starting IF condition with <aura:if> tag. If you want to define conditional expression in lightning components we have to use <aura:if> . if the change variable value is TRUE then I am displaying button with test as “I am True”, else I am displaying button with label as “I am false”
In line number ten I am using else block for the above if condition, for this we have to use the tag of <aura:set attribute=”else”/>
<ui:button> is used to create buttons in lightning components.
Here I will the button the button label as true, because of I assigned default value for the “Change” variable as true.