This is the code that I am trying to execute as below(code from Lightning Documentation with some addon)
Component:
<aura:component
implements="flexipage:availableForRecordHome,force:lightningQuickActionWithoutHeader,force:hasRecordId">
<aura:attribute name="record" type="Object"/>
<aura:attribute name="recordError" type="String"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<force:recordPreview aura:id="recordLoader"
recordId="{!v.recordId}"
layoutType="FULL"
targetRecord="{!v.record}"
targetError="{!v.recordError}"
/>
<!-- Display a header with details about the record -->
<div class="slds-page-header" role="banner">
<p class="slds-text-heading--label">{!v.record.Name}</p>
<h1 class="slds-page-header__title slds-m-right--small
slds-truncate slds-align-left">{!v.record.BillingCity}, {!v.record.BillingState}</h1>
</div>
<!-- Display Lightning Data Service errors, if any -->
<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>
Controller.js
({
doInit: function(cmp) {
var act = component.get("v.record");
console.log("act "+ act); //returns "act null"
}
})
But, it returns "act null"
I able to get the account records when using aura:doneRendering, could it be the only way of getting the record?