+ Start a Discussion
Andrew Aldis 15Andrew 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?

viewAllActivities: function(component, event, helper) {
    console.log('modalEvent 1 clicked');
    var modalEvent = $A.get("e.c:ModalEvent");
    console.log('modalEvent 1 ' + modalEvent);
      "modalName": "c:retailDashboard_SellRed_Modal",
      "modalAction": "open",
      "modalData": {
        "parentId": ""
    console.log('modalEvent 2 ' + modalEvent);

<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."/>
Raj VakatiRaj Vakati
Even name is c:ModalEvent or c:Modal ??  Are you testing in Lightning app or any other place ? 
You code looks good for me .. 
Andrew Aldis 15Andrew Aldis 15
It is ModalEvent I just labeled it modal for this forum.  What do you mean by am I testing in a lightning app?  
Raj VakatiRaj Vakati
What do you mean by am I testing in a lightning app -- YES
Andrew Aldis 15Andrew Aldis 15
Raj VakatiRaj Vakati
DO you have any namespace ?