You need to sign in to do that
Don't have an account?
Puneet_Mishra
Handling Actions with Controllers Challenge
Hi All,
I was taking the 'Handling Actions with Controllers' challenge under Lightning Component Basic and got stuck and not sure where I am wrong.
Challenge was
Add a button to the campingListItem component that when clicked, marks the item as packed.
campingListItemApp:
but everytime I run my package I am getting an error :
Can anyone explain why I am getting this error and if possible can provide me a solution.
Thank in Advance.
I was taking the 'Handling Actions with Controllers' challenge under Lightning Component Basic and got stuck and not sure where I am wrong.
Challenge was
Add a button to the campingListItem component that when clicked, marks the item as packed.
- Add a button labeled Packed! that calls the packItem controller function when clicked.
- The controller action marks the item attribute as packed, updates the item value provider and disables the button.
<aura:component > <aura:attribute name="item" type="Camping_Item__c" required="false"/> <p>Name: <ui:inputText value="{!v.item.Name}" /> </p> <p>Price: <ui:inputCurrency value="{!v.item.Price__c}" /> </p> <p>Quantity: <ui:inputNumber value="{!v.item.Quantity__c}" /> </p> <p>Packed: <ui:inputCheckbox value="{!v.item.Packed__c}"/> </p> <ui:button label="Packed!" press="{!c.packItem}" /> </aura:component>controller.js
({ packItem : function(component, event, helper) { event.getSource().set('v.disabled', true); component.set("v.item.Packed__c", true); } })I have set required=false on campingListItem due to which I can add my component to my App without provided any value
campingListItemApp:
<aura:application > <c:campingListItem /> </aura:application>
but everytime I run my package I am getting an error :
Can anyone explain why I am getting this error and if possible can provide me a solution.
Thank in Advance.
({
packItem: function(component, event, helper) {
event.getSource().set("v.disabled",true);
component.set("v.item","Packed__c=true")
}
})