function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SrtSrt 

Opportunities are not displayed with below code, Why? I am new to learning Lightning Design System and this is my first code

Application:

<aura:application >
<c:Check/>
</aura:application>
Component:

<aura:component controller="OpportunityView">    
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:attribute name="Opplist" type="object" />
    <p> Below is the list off accounts </p>
    <aura:iteration items="{!v.Opplist}" var="a">        
        <li><ui:outputText Value ="{!a.name}"/> 
        </li>
    </aura:iteration>
</aura:component>
Controller:

({
	doInit : function(component, event, helper) {
		helper.showcontact(component);
        
	}
})
 
Helper: 

({
	showcontact : function(component) {		
        var comp = component.get("c.getOpportunities")
        comp.setCallback(this,function(a){
            component.set("v.Opplist", a.getReturnValue());
        });
        $A.enqueueAction(comp);
	}
})
 
Apex Controller: (OpportunityView.apxc)

public class OpportunityView {
    
    @auraenabled
    Public static list<Opportunity> getOpportunities()
    {
        
        return [ select ID,Name from Opportunity];
    }

}

 
Rajiv Penagonda 12Rajiv Penagonda 12
Update line 5 in your code as follows:
<aura:attribute name="Opplist" type="Object[]" />
I am assuming the user who is running this has read access on Opportunity.

-Rajiv