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

c:setTagSuper outputs:

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 outputs:

sampleSetTagExc:setTagSub sets a value for the address1 attribute inherited from the super component, c: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, c:setTagSuperRef makes a reference to c:setTagSuper and sets the address1 attribute directly without using aura:set.

c:setTagSuperRef outputs: