<aura:component controller="LController"
implements="flexipage:availableForRecordHome,force:hasRecordId,lightning:hasPageReference,lightning:actionOverride"
access="global">
<aura:attribute name="pageReference" access="public" type="Object"
description="Needed for IDE support, supplied by interface lightning:hasPageReference"/>
<aura:attribute name="recordId" access="public" type="String"
description="Needed for IDE support, supplied by interface force:hasRecordId"/>
<aura:attribute name="contextData" access="private" type="Object"
description="The context this component was loaded in"/>
<aura:attribute name="legalLegitimationRecordTypeName" access="private" type="String" default="LegalLegitimation"/>
<aura:attribute name="isRendered" type="Boolean" access="private" default="false"/>
<aura:attribute name="legitimationRecordTypeId" type="String" access="private"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:if isTrue="{!v.isLegalLegitimationRendered}" >
<lightning:overlayLibrary aura:id="legalOverLayLib"/>
<!-- <c:CreateL accountId="{!v.recordId}"></c:CreateL> -->
<aura:set attribute="else">
<c:LDetails pageReference2="{!v.pageReference}"></c:LDetails>
</aura:set>
</aura:if>
</aura:component>
({
doInit : function(component, event, helper) {
helper.parsePageContext(component, component.get('v.pageReference'));
helper.validateLegalLegitimation(component, component.get('v.legalLegitimationRecordTypeName'));
},
createLegal: function(component, evt, helper) {
console.log('Creating the l modal');
var modalBody;
$A.createComponent("c:CreateL", {},
function(content, status) {
if (status === "SUCCESS") {
modalBody = content;
component.find('legalOverLayLib').showCustomModal({
header: "Smiley Application Confirmation",
body: modalBody,
showCloseButton: true,
closeCallback: function() {
alert('You closed the alert!');
}
})
}
})
}
})
I am trying to call the function 'createL' inside aura if rather than directly calling the component because I want to show this component in modal. But when I use aura:method inside aura:if I get error. But How do I solve this ? Can some one give me some pointers ?