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

  • are you getting any error or something else?
    – Ratan Paul
    Mar 9, 2016 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, 2016 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 Paul
    Mar 9, 2016 at 10:47
  • 1
    @Ratan use lightning inspector .Using inspector should help Mar 9, 2016 at 10:56
  • @MohithShrivastava Yes lightning inspector is best.. Dou you can use this extension to debug the result.
    – Ratan Paul
    Mar 9, 2016 at 11:03

2 Answers 2


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()

  • 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, 2016 at 11:03
  • Check all your variables as well that they are populated.Is your query returning rows? Mar 9, 2016 at 11:10
  • How can I see if my query return rows ?
    – dou
    Mar 9, 2016 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, 2016 at 13:05
  • 2
    The method is response.getState() ..getState is method not oroperty Mar 9, 2016 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}">
  • Thank you I correct it. But my page is still blank ...
    – dou
    Mar 9, 2016 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, 2016 at 10:43
  • @dou See the "Also this" addition.
    – Keith C
    Mar 9, 2016 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, 2016 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, 2016 at 11:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .