I am not managing to read out the value of a checkbox in my lightning component. Please find my code below:
lightning component:
< label class="slds-checkbox">
< input type="checkbox" aura:id="news" class="slds-input" checked="{!v.identityRequest.Newsletter__c}" onchange="{!c.onChange}" />
< span class="slds-checkbox--faux"></span>< /label>
apex controller:
onChange : function(component, event, helper) {
var identityRequest = component.get('v.identityRequest');
component.set('v.identityRequest',identityRequest);
console.log(identityRequest)
}
Best Answer
I believe you may just have the name of the event wrong. On the checkboxes, the event being sent is called
change
like this:Keep me posted if that solved your issue. I went by the documentation and have not tested it myself.
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_ui_inputCheckbox.htm