Activity Forums Salesforce® Discussions How do you show the map in the lightning component?

  • Deepak

    Member
    August 20, 2020 at 7:33 am

    You can show map like below:
    In component,
    <aura:attribute name="mapVar" type="List" />
    <aura:iteration items="{!v.mapVar}" var="map" >
    key :- {!map.key} and Value :- {!map.value}
    </aura:iteration>
    <lightning:button label="CreateMap" onclick="{!c.doCreatemap}" />
    In JS Controller,
    ({
    doCreatemap : function(component, event, helper) {
    var map = [];
    for(var i=0; i<10; i++){
    map.push({
    key:i,
    value:'Test' +i
    });
    }
    component.set('v.mapVar',map);
    }
    })

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos