Use <aura:set> in the markup of a sub component to set the value of an inherited attribute.
Let's look at an example. Here is the c:setTagSuper component.
<!--c:setTagSuper--> <aura:component extensible="true"> <aura:attribute name="address1" type="String" /> setTagSuper address1: {!v.address1}<br/> </aura:component>
c:setTagSuper outputs:
setTagSuper address1:
The address1 attribute doesn't output any value yet as it hasn't been set.
Here is the c:setTagSub component that extends c:setTagSuper.
<!--c:setTagSub--> <aura:component extends="c:setTagSuper"> <aura:set attribute="address1" value="808 State St" /> </aura:component>
c:setTagSub outputs:
setTagSuper address1: 808 State St
sampleSetTagExc:setTagSub sets a value for the address1 attribute inherited from the super component, c:setTagSuper.
If you’re using a component by making a reference to it in your component, you can set the attribute value directly in the markup. For example, c:setTagSuperRef makes a reference to c:setTagSuper and sets the address1 attribute directly without using aura:set.
<!--c:setTagSuperRef--> <aura:component> <c:setTagSuper address1="1 Sesame St" /> </aura:component>
c:setTagSuperRef outputs:
setTagSuper address1: 1 Sesame St