Lightning Attribute Usage:

Attributes are used dynamically set and use variable in lightning
It works like variable in apex

Attribute Declaration :

To declare an attribute in component 
<aura:attribute type="type of Attribute" name="give a name to the attribute" default="set default value">
The other types are Map,List,String,Integer etc

To access attribute in the component , use 

The following programs shows a demo of attribute usage in lightning

Create a lightning component with the below markup code
Name the component as LightningAttributeCmp or any name you like


 * created by 		:		Shiva RV
 * Date				:		14-10-2018
 * Description		:		Attribute and Action Usage in lightning

<aura:component >
    <!-- start of Attribute declaration -->
     <aura:attribute type="String" name="message" default="hello default value"></aura:attribute>
    <aura:attribute type="Integer" name="countValue" default="1"></aura:attribute>
    <!-- Register Event -->

    <!-- End Of Register Event -->
	Hello String Attribute Data --- {!v.message} 
    Hello Integer Attribute Data --- 

Below is the hello world App code:

 * created by 		:		Shiva RV
 * Date				:		13-10-2018
 * Description		:		Hello World Lighting App

<aura:application extends="force:slds">
	<!--this is the lightning app where you can place html codes , associate js code
		also can embed lightning component to it -->
    <!-- Aura:Attribute Usage -->

<c:ComponentName> </c:ComponentName> (Use helloWorld Component name you just created)


Key Notes :
*An attribute can also be set default value as shown in the example
*An attribute field value can be changed based on user actions in the program
*Attribute behaves like an variable in apex ,visible on to the instantiated component