You need to sign in to do that
Don't have an account?
granttchart
The campingListItem Lightning Component doesn't contain a button or its attributes are not set correctly when clicked.
Hi all. I've been trying to complete the "Handle Actions With Controllers" Lightning Component trailhead for two days now. My code does exactly what the challenge requests, but when I click Check Challenge, I get the error "The campingListItem Lightning Component doesn't contain a button or its attributes are not set correctly when clicked." Is this trailhead buggy?
campingListItem.cmp:
campingListItemController.js:
campingListItem.cmp:
<aura:component > <aura:attribute name='item' type='Camping_Item__c' required='true' default="{'sobjectType': 'Camping_Item__c', 'Name':'Torch', 'Price__c': 10, 'Quantity__c': 1, 'Packed__c': false}"></aura:attribute> <ui:outputText value='{!v.item.Name}'></ui:outputText> <ui:outputCheckbox value="{!v.item.Packed__c}"></ui:outputCheckbox> <ui:outputCurrency value="{!v.item.Price__c}"></ui:outputCurrency> <ui:outputNumber value="{!v.item.Quantity__c}"></ui:outputNumber> <ui:button press="{!c.packItem}" disabled="false">Packed!</ui:button> </aura:component>
campingListItemController.js:
({ packItem: function(component, event, helper) { component.set("v.item.Packed__c", true); event.getSource().set("v.disabled", true); } })
You may then run into a problem with your controller. I had to change my controller code to the following.
https://developer.salesforce.com/forums/?id=906F0000000kG33IAE