<aura:component>
<aura:attribute name="{!isOpen}" type="Boolean" default="false" access="private"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:if isTrue="{!v.isOpen}">
<div style="height: 640px;">
<section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open">
<div class="slds-modal__container">
<header class="slds-modal__header slds-modal__header_empty">
<lightning:buttonIcon iconName="utility:close" class="slds-modal__close" onclick="{!c.closeFlowModal}"/>
</header>
<div class="slds-modal__content slds-p-around_medium">
<lightning:flow aura:id="flow" onstatuschange="{!c.closeModalOnFinish}" />
</div>
</div>
</section>
<div class="slds-backdrop slds-backdrop_open"></div>
</div>
</aura:if>
</aura:component>
doInit : function(component, event, helper) {
component.set('v.isOpen', true);
var flow = component.find("flow");
flow.startFlow("New_Company_From_Object");
},
closeFlowModal : function(component, event, helper) {
component.set("v.isOpen", false);
},
closeModalOnFinish : function(component, event, helper) {
if(event.getParam('status') === "FINISHED") {
component.set("v.isOpen", false);
}
}
I created this aura component to lauch a lightning flow in modal, but when I try to save it, I get the following error:
"Failed to save NewAccountModal.cmp: Invalid attribute name: '{!isOpen}', Refer to AuraDocs for valid attribute names: Source"
Hi Ken,
I think the problem is with this line:
<aura:attribute name="{!isOpen}" type="Boolean" default="false" access="private"/>
An aura attribute doesn't need the merge field syntax, so try this instead:
<aura:attribute name="isOpen" type="Boolean" default="false" access="private"/>