Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to display a list in a lightning component : the component (Carousel.cmp)

<aura:component controller="CarouselController"  implements="forceCommunity:availableForAllPageTypes,force:appHostable,flexipage:availableForAllPageTypes">
<aura:attribute name="actualites" type="Actualite__c[]"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:iteration var="a" items="{!v.actualites}">
    {!a.Name} : {!a.Description__c}

the server side controller (CarouselController.apxc)

public with sharing class CarouselController {

public static List<Actualite__c> getActualites(){
    List<Actualite__c> actualites = [select Id, Name, Description__c from Actualite__c];
    return actualites;

public static Actualite__c getActualite(Id id){
    Actualite__c actualite = [select Id, Name, Description__c from Actualite__c WHERE Id = :id];
    return actualite;
} }

the client side controller (CarouselController.js)

doInit : function(component, event, helper) {
    var action = component.get("c.getActualites");

    action.setCallback(this, function(reponse){
        if(reponse.getState === "SUCCESS"){
            component.set("v.actualites", reponse.getReturnValue());

} })

I just try to display a dynamic list of Actualite__c but when I try to visualize it with my lightning application :

<aura:application >
<c:Carousel /></aura:application>

I just see a blank page...

Am I doing something wrong ? Thank you

share|improve this question
are you getting any error or something else? – Ratan Mar 9 at 10:30
no, I try to add a button in my component like that : <ui:button label="yo !" press="{!c.doInit}"/> ans i see the button in my page but nothing happen when i click it... (I comment the aura:handler) – dou Mar 9 at 10:39
Have you tried what Keith C suggested.. you need to change a.getReturnValue() to reponse.getReturnValue().. If still facing issue then add a console.log console.log(reponse.getReturnValue()); and check in browser console it is returning any value or not.. – Ratan Mar 9 at 10:47
@Ratan use lightning inspector .Using inspector should help – Mohith Shrivastava Mar 9 at 10:56
@MohithShrivastava Yes lightning inspector is best.. Dou you can use this extension to debug the result. – Ratan Mar 9 at 11:03
up vote 2 down vote accepted

Also check your aura:iteration.

In Your aura:repeat items you will need to use proper syntax {!v.actualites}

To debug download chrome extension for lightning inspector.

Also response.getState should be method not property .Correct syntax is response.getState()

share|improve this answer
I tried to use lightning inspector, when I see the action tab it say that the state of Action$getActualite is success... So that is what I want but I doesn't work... – dou Mar 9 at 11:03
Check all your variables as well that they are populated.Is your query returning rows? – Mohith Shrivastava Mar 9 at 11:10
How can I see if my query return rows ? – dou Mar 9 at 11:16
If I put a debugger; here : ({ doInit : function(component, event, helper) { var action = component.get("c.getActualites"); debugger; action.setCallback(this, function(reponse){ if(reponse.getState === "SUCCESS"){ component.set("v.actualites", reponse.getReturnValue()); } }); console.log("reponse.getReturnValue()"); $A.enqueueAction(action); } }) I see when debugging that it's not passing in the action.setCallback(this, function(reponse){ – dou Mar 9 at 13:05
The method is response.getState() ..getState is method not oroperty – Mohith Shrivastava Mar 9 at 13:09

In an example I have, the argument to the callback function is where the return value came from:

action.setCallback(this, function(actionResult) {
    component.set("v.contacts", actionResult.getReturnValue());            

In your code you have a.getReturnValue() instead of reponse.getReturnValue().

You should check your browser's JavaScript console for errors; if the above is the cause you should see an error there such as "a is not defined".

Also this:

<aura:iteration var="a" items="v.actualites">

should be this:

<aura:iteration var="a" items="{!v.actualites}">
share|improve this answer
Thank you I correct it. But my page is still blank ... – dou Mar 9 at 10:42
Then (assuming there are no other JavaScript errors in the console) I suggest you add some console.log calls to your JavaScript and some System.debug calls to your Apex to track down where the overall process is breaking. – Keith C Mar 9 at 10:43
@dou See the "Also this" addition. – Keith C Mar 9 at 10:50
I correct it thank you, but the problem remain the same... I don't see any error in the app.js in my browser, I try to use the deboger but I'm not feeling comfortable with it... – dou Mar 9 at 10:54
@dou I'm afraid you won't get very far unless you learn to use the debugging aids. – Keith C Mar 9 at 11:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.