3

Lightning developer guide says that events can be inherited.

A sub component that extends a super component can handle events fired by the super component. The sub component automatically inherits the event handlers from the super component.

The super and sub component can handle the same event in different ways by adding an tag to the sub component. The framework doesn't guarantee the order of event handling.

But it also says that

We don't recommend using inheritance of client-side controllers as this feature may be deprecated in the future to preserve better component encapsulation. We recommend that you put common code in a helper instead.

  • No one knows for sure but you better code like it will be or have trouble later. Consider yourself warned so to speak – Eric Dec 12 '16 at 7:04
3

I did some research following are my observations -

  • The event registered using

      <aura:registerEvent name="sampleComponentEvent" type="c:compEvent"/>
    

    will be inherited and recommended.

  • Each sub component should declare its own handler.
  • Any abstract component ideally should not have any controller.

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.