Skip to main content
HI

I am newbie to lightning , trying to understand basics. Please help me in understand each question point wise.

a) I am loading opportunity records by creating a lightning component.

public with sharing class OpportunityController

{ @AuraEnabled

public static List<Opportunity> getOpportunities()

{

List<Opportunity> opporList=[select Name from opportunity where AccountID != NULL];

return opporList;

}

}

component Name is : clientside_comp

<aura:component controller="OpportunityController">

<aura:attribute name="opportunities"

type="Opportunity[]"/>

<ui:button label="click Me"

press="{!c.getOppors}"/>

<aura:iteration var="opp"

items="{!v.opportunities}">

<p>{!opp.Name}</p>

</aura:iteration>

</aura:component>

I controller for component clientside_comp

({

"getOppors":function(component)

{

var action=component.get("c.getOpportunities");

//check for response from server

action.setCallback(this,function(response)

{

var state=response.getState();

if (state==="SUCCESS")

{

component.set("v.opportunities",response.getReturnValue());

============

}

else if(state==="INCOMPLETE")

{

}

else if(state==="ERROR")

{

var errors=response.getError();

if (errors)

{

alert('From Server:'+errors);

}

}

}); //setCallBack method ends here

$A.enqueueAction(action);

}

})

<aura:application >

<c:clientside_comp />

</aura:application>

Its working, but instead of clicking the button I want the to display opportunties list on page load event. How is it possible.

b) Please let me know how to create a TAB in lightning component, when I click the TAB it should display data. can I call this component from custom object of standard object say account?

c) can we perform a callout using a  lightning compoenet? a brief example wud be helpful to understand.

d) we use lightning components to deploy in mobile or any other use case.

    Please correct my above stmt.

e) please let me know how to deploy lignting components to mobile and what errors we can face.

d) If any interview links there pls let me know.

Thanks

Pooja B

 
1 件の回答
  1. 2016年12月12日 6:46
    hi pooja biswas

    A - : you can call the getOppors

    javaScript function when the compoent load by the aura:handler

    <aura:handler name="init" value="{!this}" action="{!c.functionName}"/>

    like-:

    <aura:component controller="OpportunityController">

    <aura:handler name="init" value="{!this}" action="{!c.getOppors}"/>

    <aura:attribute name="opportunities" type="Opportunity[]"/>

    <ui:button label="click Me" press="{!c.getOppors}"/>

    <aura:iteration var="opp" items="{!v.opportunities}">

    <p>{!opp.Name}</p>

    </aura:iteration>

    </aura:component>

    B - : you can create custom tab in lightning component go to below link

      https://teachforce.wordpress.com/2016/11/23/how-to-create-lightning-tabs-in-component/

    C-:  Yes we can rest call out using lightning component here is a example for callout from component -:

    http://www.mstsolutions.com/blog/content/invoking-apex-callout-using-lightning-component

    D-:  we can Customize and extend Lightning Experience and Salesforce1(mobile) with Lightning components. Launch components from tabs, apps, and actions.

    E-: for add lightning component on salesforce1 app

    https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_add_cmp_salesforce1.htm

     

    F- : here some important link for interviews

    https://developer.salesforce.com/page/Lightning_FAQ

    http://www.jitendrazaa.com/blog/salesforce/salesforce-faq-part-20-lightning-questions/

    http://prateeksfdc.blogspot.in/2015/08/lightning-component.html

    https://www.linkedin.com/pulse/salesforce-lightning-questions-prateek-gupta

    Thanks

    i hope it helps you

    let me inform if it helps you and mark it best answer if it helps you so it make proper solutoin for others in future :)

     
0/9000