How to get value from text box in Salesforce Lightning Component?

Sample Code:

Lightning Component:

<aura:component implements="forceCommunity:availableForAllPageTypes">
    <ui:inputText label="First Name" value="{!v.firstname}"/><
    <ui:button label="Register" press="{!c.registerUser}"/>
</aura:component>

Lightning Component Controller:

({
registerUser : function(component, event, helper) {
            alert(component.get("v.firstname"));
}
})

Cheers!!!

No comments:

Post a Comment