By using component.get(v.attrinuteName) or component.find("aura:id").get("v.value") we can pass value from component to controller.
By using component.set("v.attrinuteName",value); we can pass value from controller to lightning component.
In below code empName attribute used to store the data which is entered by user in ui:inputText.
when user click on button "callme" function gets called and the value entered in the input text box will be passed to the attribute "empName" and the result will be printed.
Firstcomponent.js
FitstComponentApp.app
<aura:application >
<c:FirstComponent />
</aura:application>
By using component.set("v.attrinuteName",value); we can pass value from controller to lightning component.
In below code empName attribute used to store the data which is entered by user in ui:inputText.
when user click on button "callme" function gets called and the value entered in the input text box will be passed to the attribute "empName" and the result will be printed.
<aura:component >
<aura:attribute name="empName" type="String"/>
<aura:attribute name="emp" type="String"/>
<ui:inputText label="Enter Name" aura:id="name" />
<ui:button label="submit" press="{!c.doInit}" /> <br />
Employee Name Entered: <ui:outputText value="{!v.empName}" />
</aura:component>
Firstcomponent.js
({
doIniti: function(component, event, helper) {
var Name = component.find("name").get("v.value");
component.set("v.empName",Name )
}
})
Check OutputFitstComponentApp.app
<aura:application >
<c:FirstComponent />
</aura:application>