• Antonio Diaz Alvarez
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
Hi, 
I am trying to finish Handle Actions with Controllers section iin Lightning components trailhead. My code works as asked in the challenge.
But I still get this error:
Challenge Not yet complete... here's what's wrong: 
The campingListItem Lightning Component doesn't contain a button or its attributes are not set correctly when clicked.


<aura:component >
    <aura:attribute name='item' type='Camping_Item__c' required='true' default="{Name:'Torch', Price__c: 10, Quantity__c: 1, Packed__c: false}"></aura:attribute>
    <aura:attribute name='disabled' type='Boolean'></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='{!v.disabled}' label='Packed!'></ui:button>
</aura:component>

({
    packItem : function(component, event, helper) {
        var item = component.get('v.item');
        component.set('v.item.Packed__c', true);
        var btnPackItem = event.getSource();
        btnPackItem.set('v.disabled', true);
    }
})