Faced an issue where unbound expressions are not working as expected. Below is the scenario.
Parent component:
<aura:component implements="force:appHostable" controller="test1" >
<aura:attribute name="campingItem" type="Camping_Item__c" default="{ 'sobjectType': 'Camping_Item__c'}" /> <aura:handler name="init" value="{!this}" action="{!c.doInit}"/> <aura:attribute name="campingItemList" type="Camping_Item__c[]"/>
<c:CampingItemList campingItems="{#v.campingItemList}" campingItem = "{#v.campingItem}"/>
</aura:component>
Parent Controller:
({
doInit : function(component, event, helper) {
var action = component.get('c.getcampingItems');
// Configure response handler
action.setCallback(this, function(response) {
var state = response.getState();
if(state === "SUCCESS") {
console.log('Working: ' + state);
component.set('v.campingItemList', response.getReturnValue());
console.log('list: ' + component.get('v.campingItemList'));
} else {
console.log('Problem getting account, response state: ' + state);
}
}
$A.enqueueAction(action);
component.set('v.campingItem.Name', 'check1');
}
});
Child Component:
<aura:component implements="force:appHostable" controller="test1">
<aura:attribute name="campingItems" type="Camping_Item__c[]"/>
<aura:attribute name="campingItem" type="Camping_Item__c" default="{ 'sobjectType': 'Camping_Item__c'}" />
<ui:message aura:Id="msg" title="Error" class="slds-hide" severity="confirm" closable="true"> Successfully deleted ID </ui:message>
ABC = {!v.campingItem.Name}
</aura:component>
Here, we are getting that value of the attribute campingItem
in the child which we are setting it in the doInit
of the parent i.e. check1
which is not supposed to be as per the developer guide as it is the unbound expression. But with list campingItemList
its working as expected mean not getting the value.