Skip to main content
added 1 character in body
Source Link
sfdcfox
  • 501.8k
  • 21
  • 473
  • 828

You can't access controller variables this way, as you would in Visualforce. Instead, you need to call the method and set the attribute appropriately.

<aura:attribute name="results" type="MyController.MyParser[]" />

    <aura:iteration items="{!v.results}" var="obj">

let action = component.get("c.getRewardsInfo");
action.setParams({caseId: component.get("v.recordId") });
action.setCallback(this, function(result) {
  if(result.getState() === "SUCCESS") {
    component.set("v.results", result.getReturnValue());
  } // handle ERROR, too.
}); 
$A.enqueueAction(action);

P.S. The inner class attributes also need to be annotated:

public class Coupon {
    @AuraEnabled public String couponCode;
    @AuraEnabled public String status;
}

You can remove:

@AuraEnabled public List<MyParser> results {get; set;}

As there is no way to access the variable.

You can't access controller variables this way, as you would in Visualforce. Instead, you need to call the method and set the attribute appropriately.

<aura:attribute name="results" type="MyController.MyParser[]" />

    <aura:iteration items="{!v.results}" var="obj">

let action = component.get("c.getRewardsInfo");
action.setParams({caseId: component.get("v.recordId") });
action.setCallback(this, function(result) {
  if(result.getState() === "SUCCESS") {
    component.set("v.results", result.getReturnValue();
  } // handle ERROR, too.
}); 
$A.enqueueAction(action);

P.S. The inner class attributes also need to be annotated:

public class Coupon {
    @AuraEnabled public String couponCode;
    @AuraEnabled public String status;
}

You can remove:

@AuraEnabled public List<MyParser> results {get; set;}

As there is no way to access the variable.

You can't access controller variables this way, as you would in Visualforce. Instead, you need to call the method and set the attribute appropriately.

<aura:attribute name="results" type="MyController.MyParser[]" />

    <aura:iteration items="{!v.results}" var="obj">

let action = component.get("c.getRewardsInfo");
action.setParams({caseId: component.get("v.recordId") });
action.setCallback(this, function(result) {
  if(result.getState() === "SUCCESS") {
    component.set("v.results", result.getReturnValue());
  } // handle ERROR, too.
}); 
$A.enqueueAction(action);

P.S. The inner class attributes also need to be annotated:

public class Coupon {
    @AuraEnabled public String couponCode;
    @AuraEnabled public String status;
}

You can remove:

@AuraEnabled public List<MyParser> results {get; set;}

As there is no way to access the variable.

Source Link
sfdcfox
  • 501.8k
  • 21
  • 473
  • 828

You can't access controller variables this way, as you would in Visualforce. Instead, you need to call the method and set the attribute appropriately.

<aura:attribute name="results" type="MyController.MyParser[]" />

    <aura:iteration items="{!v.results}" var="obj">

let action = component.get("c.getRewardsInfo");
action.setParams({caseId: component.get("v.recordId") });
action.setCallback(this, function(result) {
  if(result.getState() === "SUCCESS") {
    component.set("v.results", result.getReturnValue();
  } // handle ERROR, too.
}); 
$A.enqueueAction(action);

P.S. The inner class attributes also need to be annotated:

public class Coupon {
    @AuraEnabled public String couponCode;
    @AuraEnabled public String status;
}

You can remove:

@AuraEnabled public List<MyParser> results {get; set;}

As there is no way to access the variable.