Skip to content

Instantly share code, notes, and snippets.

@shinchit
Last active September 2, 2019 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shinchit/c7c0b99b2c5a20e8974b6e05ea54abd0 to your computer and use it in GitHub Desktop.
Save shinchit/c7c0b99b2c5a20e8974b6e05ea54abd0 to your computer and use it in GitHub Desktop.
<aura:component extends="force:slds" controller="SubClass">
<aura:attribute name="accounts" type="Account[]"/>
<aura:handler name="init" value="{!this}" action="{!c.init}" />
<ul>
<aura:iteration items="{!v.accounts}" var="account">
<li>{!account.Name} ({!account.Id})</li>
</aura:iteration>
</ul>
</aura:component>
({
init : function(component, event, helper) {
helper.getAccounts(component);
}
})
({
getAccounts : function(component) {
let action = component.get("c.getAccounts");
action.setCallback(this, function(response) {
if (response.getState() == "SUCCESS") {
component.set("v.accounts", response.getReturnValue());
}
});
$A.enqueueAction(action);
}
})
public with sharing class SubClass extends SuperClass {
}
public with sharing abstract class SuperClass {
@AuraEnabled
public static List<Account> getAccounts() {
List<Account> accounts = [SELECT Id, Name FROM Account ORDER BY Name asc];
return accounts;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment