Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A reduced test case for the issues with <lightning:input /> bindings
<aura:component implements="force:appHostable">
<!-- public attributes -->
<aura:attribute name="myObj" type="Account" default="{Name: '', Type: ''}" access="PUBLIC" />
<!-- body markup -->
<c:lightningInputReproFields record="{!v.myObj}" />
<lightning:button label="Update Object" onclick="{!c.updateObj}" />
<lightning:button label="Update Name" onclick="{!c.updateName}" />
</aura:component>
({
updateObj: function (component, event, helper) {
var rand = Math.floor(Math.random() * 99);
var newObj = {
'Name': 'new name ' + rand,
'Type': 'new type ' + rand
};
component.set('v.myObj', newObj);
},
updateName: function (component, event, helper) {
var rand = Math.floor(Math.random() * 99);
component.set('v.myObj.Name', 'new name ' + rand);
}
})
<aura:component >
<!-- public attributes -->
<aura:attribute name="record" type="Account" default="{Name: '', Type: ''}" access="PUBLIC" />
<!-- body markup -->
<lightning:input name="name" type="text" label="Name" value="{!v.record.Name}" />
<lightning:input name="type" type="text" label="Type" value="{!v.record.Type}" />
</aura:component>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.