Newer Version Available

This content describes an older version of this product. View Latest

Setting Attributes Inherited from a Super Component

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 docsample:setTagSuper component.

docsample:setTagSuper outputs:

The address1 attribute doesn't output any value yet as it hasn't been set.

Here is the docsample:setTagSub component that extends docsample:setTagSuper.

docsample:setTagSub outputs:

sampleSetTagExdocsample:setTagSub sets a value for the address1 attribute inherited from the super component, docsample:setTagSuper.

This usage of <aura:set> works for components and abstract components, but it doesn’t work for interfaces. For more information, see Setting Attributes Inherited from an Interface.

Warning

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, docsample:setTagSuperRef makes a reference to docsample:setTagSuper and sets the address1 attribute directly without using aura:set.

docsample:setTagSuperRef outputs: