19

In VF it is possible to do like:

<apex:outputField value="{!target[dynProperty]}"/>

Which expression can be used to do similar thing inside lightning component (not inside lightning js controller)? Doing like this

{!v.target[dynProperty]}

results in error:

Failed to save undefined: expecting a positive integer, found 'dynProperty' at column 10 of expression: v.target[dynProperty]: Source

Are there any ideas how to do this inside component (not js controller)?

1 Answer 1

9

The expression syntax does not support it.

You can use index array referencing, but not what you are doing here.

{!v.target[3]} - Okay

{!v.target.prop} - Okay

What you suggested, no joy.

You must log in to answer this question.

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