Can someone explain me, why object binding is not working?


<aura:component extensible="true" abstract="true" access="global">
    <aura:attribute name="testObject" type="Account" access="global"/>



<aura:component extends="c:cmpOne" access="global">  
    <ui:inputText value="{!v.testObject.Name}" /> 


<aura:component extends="c:cmpOne" access="global">
    <aura:attribute name="types" type="Aura.Component[]" access="global"/>


<aura:component extends="c:cmpOne" access="global">
    // value of field should be changed, as  this value  is changing  in  inner component
    {!v.testObject.Name} <br/> 

        <aura:set attribute="types">
            <c:cmpOneFirst testObject="{!v.testObject}"/>

No controllers.

Desired behaviour: when you change value of name field in cmpOneFirst.cmp, new value is displayed in cmpOneThird.cmp

If you change type of testObject attribute from Account to String - binding works. Any suggestions?


I've had this happen before and was able to resolve it by using a default attribute to predefine the keys/values of the object fields that you want to bind on.

Try something like this:

<aura:attribute name="testObject" type="Account" 
                default="{ 'sobjectType':'Account', 'Name' : ''}"
|improve this answer|||||

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.