Last active
September 2, 2019 23:03
-
-
Save shinchit/c7c0b99b2c5a20e8974b6e05ea54abd0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
init : function(component, event, helper) { | |
helper.getAccounts(component); | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
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); | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class SubClass extends SuperClass { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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