0

I have this event in my base.cmp:

ResourcesLoaded.evt

<aura:event type="COMPONENT" access='global'>
</aura:event>

In my component I define the event like that:

<aura:registerEvent name='ResourcesLoaded' type='c:ResourcesLoaded' access='global' />

And I add an handler like that:

<aura:handler name="ResourcesLoaded" event="c:ResourcesLoaded" action="{!c.initializeComponent}"/>

I fire the ResourcesLoaded event after my scripts are loaded.

If I execute that, everything is fine and works correctly. But now, when I create another component and embedded my base.cmp and hooks myself on the ResourcesLoaded element like this:

<c:Base ResourcesLoaded="{!c.theThingsIHaveToDoWhenIamLoaded}" />

The initializeComponent is never called. From the documentation, I think it should call both my theThingsIHaveToDoWhenIamLoaded and initializeComponent methods.

Is that a bug? I think it should be supported by lightning.

1
  • While embedding base component, you are passing resourcesLoaded in it. Is it attribute or event handler name? Commented Mar 18, 2017 at 20:57

1 Answer 1

0

The problem is in you are calling a child component method from parent <c:Base ResourcesLoaded="{!c.theThingsIHaveToDoWhenIamLoaded}" /> you cannot call the method directly in markup you may set attribute values by passing it. You may fire the event in parent and in child handler can call the respective method .Or you can use <aura:method> to call the child method...

You must log in to answer this question.

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