Skip to content

Instantly share code, notes, and snippets.

@Sunil02kumar
Last active October 30, 2018 15:04
Show Gist options
  • Select an option

  • Save Sunil02kumar/d99035ba5a6fe9b87790f15884ebc4fe to your computer and use it in GitHub Desktop.

Select an option

Save Sunil02kumar/d99035ba5a6fe9b87790f15884ebc4fe to your computer and use it in GitHub Desktop.
Aura.Component[] : Lightning Framework Specific Attributes Type
<aura:application extends="force:slds">
<c:SK_AuraComponentAttributeUsageCmp/>
</aura:application>
<aura:component >
<aura:attribute name="ltngRegionName" type="String"/>
<aura:attribute name="ltngCountriesList" type="Aura.Component[]">
<!--To set a default value for type="Aura.Component[]",
put the default markup in the body of aura:attribute-->
<ol class="slds-list--ordered">
<li><b>US</b></li>
<li><b>India</b></li>
</ol>
</aura:attribute>
<!--Mark up which can be reused-->
<div style="background-color:#E6E6FA;border-style: solid;height:100px;margin:2%;padding:1%;">
<p>{!v.ltngRegionName} Countries List</p>
{!v.ltngCountriesList}
</div>
</aura:component>
<aura:component >
<aura:attribute name="ltngAPACCountriesList" type="List"
default="['India','Sri Lanka','Bangladesh']"/>
<aura:attribute name="ltngEMEACountriesList" type="List"
default="['France','Germany']"/>
<c:SK_AuraComponentAttributeCmp ltngRegionName="Default">
<!--we are not setting ltngCountriesList attribute value so this will display
default body specified in SK_AuraComponentAttributeCmp-->
</c:SK_AuraComponentAttributeCmp>
<c:SK_AuraComponentAttributeCmp ltngRegionName="APAC">
<aura:set attribute="ltngCountriesList">
<ol class="slds-list--ordered">
<aura:iteration items="{!v.ltngAPACCountriesList}" var="country" >
<li><b>{!country}</b></li>
</aura:iteration>
</ol>
</aura:set>
</c:SK_AuraComponentAttributeCmp>
<c:SK_AuraComponentAttributeCmp ltngRegionName="EMEA">
<aura:set attribute="ltngCountriesList">
<ol class="slds-list--ordered">
<aura:iteration items="{!v.ltngEMEACountriesList}" var="country" >
<li><b>{!country}</b></li>
</aura:iteration>
</ol>
</aura:set>
</c:SK_AuraComponentAttributeCmp>
</aura:component>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment