6

I've created a couple of lightning components as well as a custom lightning event which is used in both components to talk to each other. The markup is as follows:

Lightning Event (Name : MYEVENTTYPE)

<aura:event type="COMPONENT" description="Event template" />

Component 1 (markup):

<aura:component implements="flexipage:availableForAllPageTypes" controller="FirstComponent">
    <aura:attribute name="showFirstComponent" type="Boolean" default="true"/>
    <aura:attribute name="selectedRecordId" type="String" default="" />     
    <aura:if isTrue="{!v.showFirstComponent == true}">
        <!-- First Component Body -->
        <aura:set attribute="else">
            <span>
                <NS:SecondComponent recordId="{!v.selectedRecordId}" MYEVENT="{!c.EventFiredHandler}" />
            </span>
        </aura:set>
    </aura:if>
</aura:component>

Component 1 (controller):

EventFiredHandler : function(component, event, helper) 
{
    // some code here
}

Component 2 (markup):

<aura:component implements="flexipage:availableForAllPageTypes" controller="SecondComponent">
    <aura:registerEvent name="MYEVENT" type="MYEVENTTYPE"/>
    <!-- the rest of the body for the component which fires off the function in the controller "someFunction" -->
</aura:component>

Component 2 (controller):

({
    someFunction : function(component, event, helper) {
        var cmpEvent = component.getEvent("MYEVENT");
        cmpEvent.fire();
    },
})

All of the above bundles are included in an unmanaged package (Component 1, Component 2 and MYEVENT), which uploads successfully. However, when I try to install the package into another org (Summer '15 Sandbox with enabled lightning components), I get the aforementioned error.

Has anyone experiences such a problem before? What am I missing?

2

It turns out that I was missing the namespace when registering the event:

<aura:registerEvent name="MYEVENT" type="MYEVENTTYPE"/>

Should be:

<aura:registerEvent name="MYEVENT" type="NS:MYEVENTTYPE"/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.