I would like to pass an array of objects from my js file to an aura attribute. I know the list contains values and is correct before I pass it to the aura component but the list is empty when I log that attribute to the console.
Helper method:
//convert map into list of objects for Aura
var objects = [];
for(var rawLineItem in result.rawLineItemToContactIdList) {
objects.push({key:rawLineItem, value:result.rawLineItemToContactIdList[rawLineItem]});
console.log('objects: ' + JSON.stringify(objects));
}
component.set("v.objectList", objects);
Aura attribute:
<aura:attribute name="objectList" type="List" />
EDIT: Then I log the objectList varible to the console:
Aura:
<button class="slds-button slds-button_brand" onclick="{!c.showDupes}" >Log</button>
Helper:
showDupes: function(component, event, helper) {
var objectList = component.get("v.objectList");
console.log('objectList: ' + JSON.stringify(objectList));
},
Object[]
and see if that works for you.objectList
at the bottom of my Helper code after logging it to the console, knowing it's correct. Then I have a button which calls a function in the helper to console.log that attribute. I will add the code for that function