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.

  • While embedding base component, you are passing resourcesLoaded in it. Is it attribute or event handler name? – Muzammil Bajaria Mar 18 '17 at 20:57
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...

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.