You need to sign in to do that
Don't have an account?

In Lighting , getting the values in the Console but not getting values in component
Apex class:
Component:
iam calling in the application :
Thanks
Deepika
public class Auraopportunity { @AuraEnabled public static list<opportunity> getdata(){ list<opportunity>lstopp =[select id, name, type, amount from opportunity limit 5]; return lstopp; } }
Component:
<aura:component controller="Auraopportunity"> <aura:attribute name ="opportunities" type="list"/> <aura:iteration items="{!v.opportunities}" var="a"> <h1>{!a.id}</h1> </aura:iteration> <aura:handler name="init" value="{!this}" action="{!c.show}"/> </aura:component>Controller
({ show : function(component, event, helper) { alert("Hello"); var abc= component.get("c.getdata"); console.log("Method is invoked"); abc.setCallback(this,function(response){ var state = response.getState(); console.log(state); if(state === "SUCCESS"){ var result = response.getReturnValue(); console.log(result); alert(result); component.set("!v.opportunities", result); }else{ console.log("Failed"); } }); $A.enqueueAction(abc); } })
iam calling in the application :
<aura:application > <c:Auraoppiteration/> </aura:application>it is not getting display, may i know , im getting the timeout error itseems, ..
Thanks
Deepika
component.set("v.opportunities", result); //but not executed.
In aura:iteration instead of a.id use a.Id
i.e change <h1>{!a.id}</h1> to <h1>{!a.Id}</h1>
the I in the a.id should be capital i.e : a.Id
this should solve your problem.
Aman