Good afternoon everyone,

Now that custom labels are supported in Lightning. Has anyone had any success parameterizing them like the person did in this post? I'm trying to pass an attribute value as the label name.

Based on the post I tried the following syntax variations and cannot get it to work. I keep receiving a syntax error:

{!$Label.c.[v.labelname]} {!$Label[v.labelname]} {!$Label.[v.labelname]}


1 Answer 1


Won't work right now.

  1. We don't support map[variable] de-referencing.

  2. Labels are going to be pre-parsed from the file to see what is necessary, and to do that it's essentially a regular expression $Label.(\w).(\w) -- (Note: not the actual regex) which we use to send down the labels with. If you have it as a variable we won't know which labels to send.

  3. If you did in fact have the label, you could do this in Javascript.

    $A.get("$Label." + cmp.get("v.labelname"));

  • 1
    Is it not possible to do map[variable] de-referencing at all in the markup currently? Not just with Custom Labels? If so, would there be an alternative way to get around that? Commented Aug 5, 2015 at 17:56
  • Correct, no way to do it currently. you can do map["key"], but that just turns into map.key.
    – Kris Gray
    Commented Aug 5, 2015 at 19:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .