You need to sign in to do that
Don't have an account?

trailhead Challenge in lightning : lightning components basics module-->Handle action with controller-->Mark Item as Packed
Hi All,
with below code I have completed the challenge thanks!!...When I tried to add this componet to Application and tried to check the UI part..I got below error, Can some one please let me know what the mistake is???
Something has gone wrong. [NoErrorObjectAvailable] Aura.loadComponent(): Failed to initialize application. An internal server error has occurred Error ID: 991118890-131685 (-1741317831) . Please try again.
APP:
<aura:application >
<c:campingListItem />
</aura:application>
COMPONENT:
<aura:component >
<aura:attribute name="item" type="Camping_Item__c" required="true"/>
<ui:outputText value="{!v.item}"/>
<ui:outputText value="{!v.item.Name}"/>
<ui:outputCheckbox value="{!v.item.Packed__c}"/>
<ui:outputCurrency value="{!v.item.Price__c}"/>
<ui:outputNumber value="{!v.item.Quantity__c}"/>
<ui:button label="packed!" press="{!c.packItem}" >
</ui:button>
</aura:component>
CONTROLLER:
({
packItem: function(component, event, helper) {
var a = component.get("v.item",true);
a.Packed__c = true;
component.set("v.item",a);
var btnClicked = event.getSource();
btnClicked.set("v.disabled",true);
}
})
Thanks
with below code I have completed the challenge thanks!!...When I tried to add this componet to Application and tried to check the UI part..I got below error, Can some one please let me know what the mistake is???
Something has gone wrong. [NoErrorObjectAvailable] Aura.loadComponent(): Failed to initialize application. An internal server error has occurred Error ID: 991118890-131685 (-1741317831) . Please try again.
APP:
<aura:application >
<c:campingListItem />
</aura:application>
COMPONENT:
<aura:component >
<aura:attribute name="item" type="Camping_Item__c" required="true"/>
<ui:outputText value="{!v.item}"/>
<ui:outputText value="{!v.item.Name}"/>
<ui:outputCheckbox value="{!v.item.Packed__c}"/>
<ui:outputCurrency value="{!v.item.Price__c}"/>
<ui:outputNumber value="{!v.item.Quantity__c}"/>
<ui:button label="packed!" press="{!c.packItem}" >
</ui:button>
</aura:component>
CONTROLLER:
({
packItem: function(component, event, helper) {
var a = component.get("v.item",true);
a.Packed__c = true;
component.set("v.item",a);
var btnClicked = event.getSource();
btnClicked.set("v.disabled",true);
}
})
Thanks
<aura:attribute name="item" type="Camping_Item__c" required="true"
default="{Name:'ABC', Price__c:100, Quantity__c:1, Packed__c:false}"/>