I have used map as attribute type in Lightning component. In markup how can i print the value from this map? I need syntax only. I am creating map from js controller of component.


1 Answer 1


So you have to use a child component to get the values from map using javascript

for example


   <c:ChildComponent mapObject="{!v.YourMap}" mapKey="{v.mapKey}"> 


In child component

    <aura:attribute name="mapObject" type="Map" />
    <aura:attribute name="mapKey" type="String" />
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>

   <ui:outputText aura:Id="outputTextId" />


ChildComponent controller

    doInit : function(component, helper) {
        var mapObject= component.get('v.mapObject');
        var mapKey = component.get('v.mapKey');
        var outputText = component.find("outputTextId");


  • By the way i found the perfect match here which essentially resolved my query. But your answer is also relevant to question so, i marked as answer. Apr 25, 2017 at 8:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.