Aura if else condition in salesforce lightning


<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" >
    <aura:attribute name="FirstName" type="String"/>
    <aura:attribute name="LastName" type="String"/>
    <aura:attribute name="mobile" type="Integer"/>
    <aura:attribute name="Email" type="String"/>
    <aura:attribute name="details" type="boolean" default="true" />
    <aura:renderIf isTrue="{!v.details}">
    <div align="center" style="width:300px;">
    <lightning:input type="Text"  label="FirstName" placeholder="Please enter FirstName"  aura:id="FirstName" value="{!v.FirstName}" updateOn="keyup" />
    <lightning:input type="Text"  label="LastName" placeholder="Please enter LastName"   aura:id="LastName"  value="{!v.LastName}" updateOn="keyup"/>
    <lightning:input type="tel" label="Mobile" placeholder="Please enter MobileNo"   aura:id="mobile" value="{!v.mobile}" updateOn="keyup"/>
    <lightning:input type="Email"  label="Email" placeholder="Please enter EmailId"   aura:id="Email" value="{!v.Email}" updateOn="keyup"/>
    </div>
    <ui:button  label="submit" press="{!c.doClick}"/>
    <aura:set attribute="else">
    <b>FirstName:</b><ui:outputText  value="{!v.FirstName}"/><br/>
    <b>LastName:</b><ui:outputText value="{!v.LastName}"/><br/>
    <b>Mobile:</b><ui:outputText value="{!v.mobile}"/><br/>
    <b>Email:</b><ui:outputText value="{!v.Email}"/><br/>
   </aura:set>
   </aura:renderIf>
</aura:component>


({
    doClick:function(component,event,helper){
        console.log('method is called');
        var getAttributeValue=component.get("v.details");
        console.log('Attribute value:'+getAttributeValue)
        var setAttributevalue=component.set("v.details",false); 
     
         
    } 
   
})

Comments

  1. Thank you for any other great post. Where
    else may just anyone get that kind of info in such a perfect means of
    writing? I have a presentation next week, and I'm at the look
    for such info.

    ReplyDelete
  2. Ridiculous quest there. What occurred after? Thanks!

    ReplyDelete
  3. Yeah bookmaking this wasn't a high risk conclusion outstanding
    post!

    ReplyDelete
  4. I was honored to receive a call from my friend when he uncovered the important ideas shared in your site.
    Browsing your blog write-up is a real excellent experience.
    Thank you for thinking about readers at all like me, and I want for you the best of achievements as a professional in this field.

    ReplyDelete
  5. If some one wants expert view concerning
    blogging and site-building then i recommend him/her to
    go to see this web site, Keep up the good work.

    ReplyDelete
  6. Thanks a lot for sharing that useful information. That was a really Intresting post and I would really like to know more.

    salesforce development company
    Salesforce development services
    Salesforce Consultant

    ReplyDelete

Post a Comment