No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
Newer Version Available
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.
1swfobject.registerObject("clippy.codeblock-0", "9");<!--docsample:setTagSuper-->
2<aura:component extensible="true">
3 <aura:attribute name="address1" type="String" />
4 setTagSuper address1: {!v.address1}<br/>
5</aura:component>
6docsample:setTagSuper outputs:
1setTagSuper address1: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.
1swfobject.registerObject("clippy.codeblock-2", "9");<!--docsample:setTagSub-->
2<aura:component extends="docsample:setTagSuper">
3 <aura:set attribute="address1" value="808 State St" />
4</aura:component>
5docsample:setTagSub outputs:
1setTagSuper address1: 808 State StsampleSetTagExdocsample:setTagSub sets a value for the address1 attribute inherited from the super component, docsample: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, docsample:setTagSuperRef makes a reference to docsample:setTagSuper and sets the address1 attribute directly without using aura:set.
1swfobject.registerObject("clippy.codeblock-4", "9");<!--docsample:setTagSuperRef-->
2<aura:component>
3 <docsample:setTagSuper address1="1 Sesame St" />
4</aura:component>
5docsample:setTagSuperRef outputs:
1swfobject.registerObject("clippy.codeblock-5", "9");setTagSuper address1: 1 Sesame St
2