This is to me the most restricting drawback of Lightning compared to Visualforce. A way to dynamically bind/access properties like values of fields.
To make complex component structures fast I don't want to pass around queried SObjects. Instead I want to pass record Ids and field names. Lightning Data Service then fetches the record.
Saving this component:
<aura:component>
<aura:attribute name="recordId" type="String" />
<aura:attribute name="field" type="String" />
<aura:attribute name="record" type="Object" access="private" />
<force:recordData recordId="{!v.recordId}" targetFields="{!v.record}" layoutType="FULL" recordUpdated="{!c.init}" />
<lightning:input value="{!v.record[field]}" ... />
</aura:component>
fails with:
Failed to save xyz.cmp: expecting a positive integer, found 'field' at column 10 of expression: v.record[field]: Source
I know that this currently is as designed and I'm not interested in "dirty" quickhacks. I want to know:
- Is there any IdeaExchange I could vote for?
- Is this on anyones roadmap?
- What's the technical reason / design decision for not having this?