+ Start a Discussion
sumit dsumit d 

Fields value are not showing in Aura component

Hi All,

 I have a lightning component in which i am trying to show fields value from record of custom metadata. the metadata has 4 records so i am trying to show the value of fields. I have four metadata records and i want to show the Button_Label__c field values for each record in component.
What am i missing on it?
my component is given below:- 

<aura:component controller="PortalHomeController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    <aura:attribute name="buttonList" type="Button_Configuration__mdt[]"  default=""/>
    <aura:attribute name="buttons" type="List" />
         <aura:handler name="init" value="{!this}" action="{!c.fetchCodes}"/>

 <strong>{!v.buttons[0].Button_Label__c} </strong>
 <strong>{!v.buttons[1].Button_Label__c} </strong>
 <strong>{!v.buttons[2].Button_Label__c} </strong>
 <strong>{!v.buttons[3].Button_Label__c} </strong>
</aura:component>
JS Controller:-
({
    fetchCodes : function(component, event, helper) {
         component.set('v.mycolumns', [
            {label: 'Button Label', fieldName: 'Button_Label__c', type: 'text'},
                {label: 'Description', fieldName: 'Description__c', type: 'text'}
            ]);
        var action = component.get("c.getButtonMetaData");
        action.setParams({
        });
        action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                component.set("v.buttons", response.getReturnValue());
            }
        });
        $A.enqueueAction(action);
    }
})
Apex controller:- 

public class PortalHomeController {
    @AuraEnabled
    public static List<Button_Configuration__mdt> getButtonMetaData(){
        List<Button_Configuration__mdt> buttonList = [Select Id, MasterLabel, Button_Label__c, Description__c 
                                                      From Button_Configuration__mdt
                                                      ORDER BY MasterLabel
                                                     ];
         //List<Button_Configuration__mdt> listButton = List<Button_Configuration__mdt>();
        Button_Configuration__mdt button1;
        Button_Configuration__mdt button2;
        Button_Configuration__mdt button3;
        Button_Configuration__mdt button4;
       
        for(Button_Configuration__mdt bt :buttonList){
            if(bt.Label =='Button 1'){
                button1 = bt;
                  
            }else 
                if(bt.Label =='Button 2'){
                button2 = bt;
                     
                }else 
                    if(bt.Label =='Button 3'){
                    button3 = bt;
                         
                    }else if(bt.Label =='Button 4'){
                       button4 = bt;  
                   }
        }
        system.debug('custCredentialList ' + buttonList);
        return buttonList;    
    }
}