2

Can Components subscribe and handle app-events which have been fired by themselves?

<aura:handler name="refresh" event="c:elfLC_recordRefresh" action="{!c.appEvent}"/>
<aura:registerEvent name="eventRecordRefresh" type="c:elfLC_recordRefresh"/>

It looks like I can fire the event successfully like this with no issues:

var appEvent = $A.get("e.c:elfLC_recordRefresh");
appEvent.setParams({"message" : "test"});
appEvent.fire();

But I' not able to receive and handle it like this:

appEvent : function(cmp, evt, hlp) {
    console.log('this should be logged...');
},

Any ideas?

3
  • 2
    I think yes, they can do it. Can you check by removing the name attribute from handler. I believe that is not required.
    – manjit5190
    Dec 22, 2016 at 18:17
  • 1
    @manjit_singh cool thx, omitting the name solved the issue.
    – Uwe Heim
    Dec 22, 2016 at 18:22
  • @manjit_singh You may want to put that as an answer :) Dec 22, 2016 at 23:45

1 Answer 1

1

I think yes, they can do it. You will have to remove the name attribute from handler. I believe that is not required.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .