RadioButton Functionality in Salesforce Lightning
RadioButtons.cmp
----------------
<aura:component >
<ui:inputRadio text="Demo1" label="Demo1" change="{!c.onClick}"/><br/>
<ui:inputRadio text="Demo2" label="Demo2" change="{!c.onClick}"/><br/>
</aura:component>
RadioButtonsController.js
-------------------------
({
onClick: function(component, event) {
var selected = event.getSource().get("v.text");
alert(selected);
}
})
Lightning ApplicationException
--------------------------------
<aura:application extends="force:slds" >
<c:RadioButtons/>
</aura:application>
----------------
<aura:component >
<ui:inputRadio text="Demo1" label="Demo1" change="{!c.onClick}"/><br/>
<ui:inputRadio text="Demo2" label="Demo2" change="{!c.onClick}"/><br/>
</aura:component>
RadioButtonsController.js
-------------------------
({
onClick: function(component, event) {
var selected = event.getSource().get("v.text");
alert(selected);
}
})
Lightning ApplicationException
--------------------------------
<aura:application extends="force:slds" >
<c:RadioButtons/>
</aura:application>
Comments
Post a Comment