I am not able to open another lightning component in a modal by simply referencing the component
<div class="slds-modal__content slds-p-around--medium">
<div>
<!--<ui:inputSelect class="single" aura:id="InputSelectSingle" change="{!c.selection}">
</ui:inputSelect>-->
<c:CandidatePatientComponent></c:CandidatePatientComponent>
</div>
</div>
Please let me know how to achieve this.
//Code that I tried
<aura:component >
<ui:button label="openmodal" press="{!c.openmodal}" />
<div role="dialog" tabindex="-1" aria-labelledby="header43" aura:id="Modalbox" class="slds-modal">
<div class="slds-modal__container">
<div class="slds-modal__header">
<button class="slds-button slds-modal__close slds-button--icon-inverse" title="Close" onclick="{!c.closeModal}">
<span class="slds-assistive-text">Close</span>
</button>
<h2 id="header43" class="slds-text-heading--medium">Test Modal</h2>
</div>
<div class="slds-modal__content slds-p-around--medium">
<div>
<c:LeadCreation/>
</div>
</div>
<div class="slds-modal__footer">
</div>
</div>
</div>
<div class="slds-backdrop " aura:id="Modalbackdrop"></div>
</aura:component>
Controller code
({
closeModal:function(component,event,helper){
var cmpTarget = component.find('Modalbox');
var cmpBack = component.find('Modalbackdrop');
$A.util.removeClass(cmpBack,'slds-backdrop--open');
$A.util.removeClass(cmpTarget, 'slds-fade-in-open');
},
openmodal: function(component,event,helper) {
var cmpTarget = component.find('Modalbox');
var cmpBack = component.find('Modalbackdrop');
$A.util.addClass(cmpTarget, 'slds-fade-in-open');
$A.util.addClass(cmpBack, 'slds-backdrop--open');
}
})
Component B code
<aura:component controller="LeadCreateController"
implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes"
access="global" >
<!-- Define Attribute-->
<aura:attribute name="candidate" type="Lead" default="{'sobjectType': 'Lead',
'FirstName': '',
'LastName': '',
'Country': '',
'Company':''
}"/>
<div class="container-fluid">
<h3>Please Enter The Candidate Information</h3>
<div class="form-group">
<label>First Name</label>
<ui:inputText class="form-control" value="{!v.candidate.FirstName}"/>
</div>
<div class="form-group">
<label>Last Name</label>
<ui:inputText class="form-control" value="{!v.candidate.LastName}"/>
</div>
<div class="form-group">
<label>Country</label>
<ui:inputText class="form-control" value="{!v.candidate.Country}"/>
</div>
<div class="form-group">
<label>Company</label>
<ui:inputText class="form-control" value="{!v.candidate.Company}"/>
</div>
</div>
<div class="col-md-4 text-center">
<ui:button class="btn btn-default" press="{!c.create}">Create</ui:button>
</div>
</aura:component>