My goal initially was to avoid pasting my common functions into every new components helper.js file (previously researched) and I found out that you can extend the components (some example codes) I tried making a very simple base/abstract component and extending it like so:
1.Abstract component:
<aura:component extensible="true">
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<!--<aura:handler event="aura:waiting" action="{!c.loaderStart}"/>-->
<!--<aura:handler event="aura:doneWaiting" action="{!c.loaderStop}"/>-->
<p>This is inside abstract</p>
</aura:component>
abstract controller
({
doInit: function(component, event, helper) {
console.log('doInit', component, event, helper);
}
/*
loaderStart: function(component, event, helper) {
console.log('loaderStart');
},
loaderStop: function(component, event, helper) {
console.log('loaderStop');
}
*/
})
abstract helper (just a bunch of simple stuff)
({
closeQuickAction: function () {
$A.get('e.force:closeQuickAction').fire();
},
refreshView: function () {
$A.get('e.force:refreshView').fire();
},
navigateToRecord: function (recordId) {
// 'slideDevName': ( 'chatter', 'related', 'detail' )
$A.get('e.force:navigateToSObject').setParams({'recordId': recordId, 'slideDevName': 'related'}).fire();
}
})
2.And the component that extends it:
<aura:component extends="c:CmpBase" implements="force:lightningQuickAction">
<p>This is inside extender</p>
<lightning:button type="button" label="Test"/>
</aura:component>
This components (2) content does not show. Why?
Edit: contents and the console.log of the abstract component do show!
Found the docs: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/oo_cmp_attributes.htm