Tuesday 12 April 2016

Lightining examples

1
2
3
4
5
6
public class AuraExample1 {
  @AuraEnabled
  public Static String getName(){
        return 'Satish Myla';
   }
}



public class AuraExample2 {
   @AuraEnabled
    public Static Account[] getAccounts(){
        List<Account> accs=[select id,name from Account limit 4];
        return accs;
    }

}
<aura:component >
                <ui:inputText aura:id="name" label="Enter Name:" placeholder="Your Name" />
                <ui:button aura:id="button" label="Click me" press="{!c.getInput}"/>
                <ui:outputText aura:id="outName" value="" class="text"/>
</aura:component>
<aura:component controller="AuraExample1">
   <aura:attribute name="empName" type="string" />
    <ui:button label="Get EmpData" press="{!c.show}"/>
    Employee Name :{! v.empName}
</aura:component>---------------

<aura:component controller="AuraExample2">
   <aura:attribute name="Accounts" type="Account[]" />
   <ui:button label="Get Accounts" press="{!c.getAccs}"/> 
   <aura:iteration var="a" items="{!v.Accounts}">
       <p>{!a.Name} : {!a.Id}</p>
   </aura:iteration>
</aura:component>-----------------
<aura:component controller="AuraExample2">
   <aura:attribute name="Accounts" type="Account[]" />
   <ui:button label="Get Accounts" press="{!c.getAccs}"/> 
   <aura:iteration var="a" items="{!v.Accounts}">
       <p>{!a.Name} : {!a.Id}</p>
   </aura:iteration>
</aura:component>
<aura:component >
                <aura:attribute name="header" type="Aura.Component[]"/>
                <div>
                                <span class="header">{!v.header}</span><br/>
                                <span class="body">{!v.body}</span>
                </div>
</aura:component>
<aura:component >
                <aura:attribute name="edit" type="Boolean" default="false"/>
                <aura:if isTrue="{!v.edit}">
                                <ui:button label="Edit"/>
        <aura:set attribute="else">
                No button
        </aura:set>
                </aura:if>

</aura:component>
public class AuraExample2 {
   @AuraEnabled
    public Static Account[] getAccounts(){
        List<Account> accs=[select id,name from Account limit 4];
        return accs;
    }

}-------------------


No comments:

Post a Comment