You need to sign in to do that
Don't have an account?
Andrew Aldis 15
$A.get("e.c:ModalEvent"); coming back undefined
I am trying to retrieve a lightning component from another component. however when I try it comes back as undefined. I have used this code in other components and it works but I cannot see why it is not working with this one. Am I overlooking something?
code:
viewAllActivities: function(component, event, helper) {
console.log('modalEvent 1 clicked');
var modalEvent = $A.get("e.c:ModalEvent");
console.log('modalEvent 1 ' + modalEvent);
modalEvent.setParams({
"modalName": "c:retailDashboard_SellRed_Modal",
"modalAction": "open",
"modalData": {
"parentId": ""
}
});
console.log('modalEvent 2 ' + modalEvent);
modalEvent.fire();
},
Modal
<aura:event type="APPLICATION" description="Event to control modals within the OFI_ModalManager">
<aura:attribute name="modalName" type="String" description="Name of the Modal to be affected."/>
<aura:attribute name="modalAction" type="String" description="Action to be performed: Open, Close."/>
<aura:attribute name="modalData" type="Object" description="An object containing data to be passed to the Modal."/>
</aura:event>
code:
viewAllActivities: function(component, event, helper) {
console.log('modalEvent 1 clicked');
var modalEvent = $A.get("e.c:ModalEvent");
console.log('modalEvent 1 ' + modalEvent);
modalEvent.setParams({
"modalName": "c:retailDashboard_SellRed_Modal",
"modalAction": "open",
"modalData": {
"parentId": ""
}
});
console.log('modalEvent 2 ' + modalEvent);
modalEvent.fire();
},
Modal
<aura:event type="APPLICATION" description="Event to control modals within the OFI_ModalManager">
<aura:attribute name="modalName" type="String" description="Name of the Modal to be affected."/>
<aura:attribute name="modalAction" type="String" description="Action to be performed: Open, Close."/>
<aura:attribute name="modalData" type="Object" description="An object containing data to be passed to the Modal."/>
</aura:event>
You code looks good for me ..