0

I am working through one of the Salesforce Lightning modules.

I completed the challenge (passed it). The challenge was about creating the lightning component.

But now when I incorporate the created component into a blank lightning app nothing works.

Here are my lightning component bundle parts and the app.

campingListItem.cmp :

<aura:component >
    <aura:attribute name="item" type="Camping_Item__c" required="true" />
    <p>{!v.item.name}</p>
    <p>{!'Name: ' + v.item.name}</p>
    <lightning:formattedNumber value="{!v.item.Price__c}" style="currency"/>
    <lightning:formattedNumber value="{!v.item.Quantity__c}" style="currency"/>
    <lightning:input type="toggle"                            
                         label="Packed?"                           
                         name="packed"                         
                         checked="{!v.item.packed__C}" />    
    <lightning:button label="Packed!" onclick="{!c.packItem}"/>
</aura:component>

campingListItemController.js :

({
    packItem : function(component, event, helper) {
        var item = component.get("v.item");
        item.packed__C = true;

        var button = event.getSource();
        button.disabled = true;
    }
})

appForTheVerification.app :

<aura:application >
     <c:campingListItem/>
</aura:application>

All the files above were developed in the developer console. So, now with the appForTheVerification.app tab being open I am clicking to preview the created app and component respectively.

The window of my browser opens and here is what I see: enter image description here

And the loading is stuck there forever. So, I can not see the component I created.

Here are the console errors from the browser which opened the preview:

aura_prod.js:805 Uncaught Aura.loadComponent(): Failed to initialize application.
An internal server error has occurred
Error ID: 942931036-81876 (1552973958)
throws at https://brave-bear-114723-dev-ed.lightning.force.com/auraFW/javascript/1bO4dJePbDnoI-_VdhdsEQ/aura_prod.js:38:15 $y
a @ aura_prod.js:805
ui-icons_222222_256x240.png:1 Failed to load resource: the server responded with a status of 404 (Not Found)

What am I doing wrong?

I may tell for sure that the problem is not in the some ui-icon GET request. Since I got the same error while completing my another challenge and still everything continues to work just fine. enter image description here

1
  • remove the required="true" tag from the component or pass 'item' from Application. Commented May 20, 2018 at 15:04

1 Answer 1

2

You need to set default value as my example below shows:
<aura:attribute name="item" type="Camping_Item__c" required="true" default="{Name:'Testing ABC', Price__c:100, Quantity__c:001, Packed__c:false}"/>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .