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)?

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.

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.