Using Attributes in Component :

This component shows how to declare attributes
Action button is used to set the user input onto the attribute

To use a attribute in the component, use


To Access the attribute in js of the component , use


The following program is a demo of attribute usage and action usage in lightning
Component Code :

Create a lightning component with the below markup code
Name the component as UsingParameterInLightning_Cmp 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 Message String Attribute Data --- {!v.message} 
    Hello Counter Integer Attribute Data --- 
    <lightning:input name="userInput" value="" label="Your Input Text" aura:id="userInput"/>
    <lightning:button name="Set This Value" label="Set This Value" onclick="{!c.handleActionToSet}"></lightning:button>
Component Js Code :

Go to the component controller and copy paste the below code 

	handleActionToSet : function(component, event, helper) {
		//This method is used to set the attribute of component
        var inputText=component.find("userInput").get("v.value");
            inputText="no value is entered in the text box";
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 UsingParameterInLightning_Cmp  or the Component name you just created)