Last active
September 16, 2019 22:54
-
-
Save shinchit/2dfcc65a802be11f6e89245343ab7c5a 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> | |
<aura:attribute name="contacts" type="Contact[]" /> | |
<aura:handlr name="change" value="{!v.contacts} action="{!c.changeContacts}" /> | |
<div aura:id="container"> | |
</div> | |
</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
({ | |
changeContacts : function(component, event, helper) { | |
helper.loadContactItems(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
({ | |
loadContactItems : function(component) { | |
let contacts = component.getReference("v.contacts") || []; | |
let container = component.find("container"); | |
$A.createComponent( | |
"c:ContactItems", | |
{ | |
"aura:id": "ContactItemsComponent", | |
"contacts": contacts | |
}, | |
function(newContactItems, status, errorMessage) { | |
if (status === "SUCCESS") { | |
container.set("v.body", [newContactItems]); | |
} else if (status === "INCOMPLETE") { | |
console.log("No response from server or client is offline."); | |
} else if (status === "ERROR") { | |
console.log("Error: " + errorMessage); | |
} | |
} | |
); | |
} | |
}) |
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> | |
<aura:attribute name="contacts" type="Contact[]"/> | |
<aura:iteration items="{!v.contacts}" var="p"> | |
<c:ContactItem fullName="{!p.Name}" accountName="{!p.Account.Name}" /> | |
</aura:iteration> | |
</aura:component> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment