Home SALESFORCELightning Passing parameters from Lightning Component to Controller and Controller to Component

Passing parameters from Lightning Component to Controller and Controller to Component

In this example to learn about to pass parameters from Lightning component to controller vice versa

By using component.get(v.attributeName) or  component.find(“aura:id”).get(“v.value”) ->pass value from Lightning Component to Controller.
By using component.set(“v.attributeName”,value);  -> pass value from Controller to Lightning Component.

Component:

<aura:component > <aura:attribute name="employeeName" type="String"/> <ui:inputText label="Enter Employee Name" aura:id="name" /> <ui:button label="submit" press="{!c.callme}" /> <br /> Employee Name Entered: <ui:outputText value="{!v.employeeName}" /> </aura:component> Controller.js
({ callme : function(component, event, helper) { var EmployeeName = component.find("name").get("v.value"); component.set("v.employeeName",EmployeeName) } })

You may also like

Leave a Comment

*