1
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId" access="global" >
    <aura:attribute name="boatReview" type="BoatReview__c" access="global"/>
    <aura:attribute name="boatReviewRecord" type="BoatReview__c" access="global"/>
    <aura:attribute name="boat" type="Boat__c"/>
     **<aura:attribute name="recordError" type="String" access="private"/>**
    <!--<aura:attribute name="recordError1" type="String" access="public"/>-->
    <aura:registerEvent name="boatReviewAdded" type="c:BoatReviewAdded"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <force:recordData aura:id="service"
                      **targetError="{!v.recordError}"**
                      targetRecord="{!v.boatReviewRecord}"
                      targetFields="{!v.boatReview}"
                      fields="Id,Name,Comment__c,Boat__c"
                      recordUpdated="{!c.onRecordUpdated}"
                      mode="EDIT"
                      />

    <lightning:layout multipleRows="true">
            <lightning:layoutItem size="12" padding="around-small">
                <lightning:input name="title" label="Title" value="{!v.boatReview.Name}"/>
            </lightning:layoutItem>

            <lightning:layoutItem size="12" padding="around-small">
                <label class="slds-form-element__label" for="input-id-01">Description</label>
                <lightning:inputRichText value="{!v.boatReview.Comment__c}" disabledCategories="FORMAT_FONT"/>
            </lightning:layoutItem>

            <lightning:layoutItem size="12" class="slds-align--absolute-center">
                <lightning:button iconName="utility:save" label="Submit" onclick="{!c.onSave}"/>
            </lightning:layoutItem>
    </lightning:layout>
     <aura:if isTrue="{!not(empty(v.recordError))}">
        <div class="recordError">
            <ui:message title="Error" severity="error" closable="true">
                {!v.recordError}
            </ui:message>
        </div>
    </aura:if>
</aura:component>

I'm getting this error :

enter image description here

2

We cannot pass private attributes to child components. Private components are only accessible inside that component. Not in parent nor in child. So you have to make recordError attribute public.

| 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.