function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Yan KuangYan Kuang 

For Developer Intermediate > Lightning Components Basics > Attributes and Expressions Challenge Issue

For Developer Intermediate > Lightning Components Basics > Attributes and Expressions challenge, even though it verified, but page is not displaying correctly.

It gave the following error when trying the run the page.

This page has an error. You might just need to refresh it.
Aura.loadComponent(): Failed to initialize application.
An internal server error has occurred
Error ID: 1877814438-103028 (-1501584897)

If I remove the required="true" from the aura:attribute it loads but it doesn't load any data.
SandhyaSandhya (Salesforce Developers) 
Hi Yan Kuang,

Please check if you have enabled namespace in your org as this challenge will not be passed if you have enabled.

Below is the code which worked for me.
 
<aura:component >
    <aura:attribute name="item" type="Camping_Item__c" required="true"/>
    
    <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}"/>   
    
</aura:component>

Please refer below link for a similar issue.

https://developer.salesforce.com/forums/?id=906F0000000kCoeIAE
 
Hope this helps you!

Please mark it as Best Answer if my reply was helpful. It will make it available for other as the proper solution.
 
Thanks and Regards
Sandhya

 
Yan KuangYan Kuang
Hi Sandhya,

Thank you for the response, I think I am able to get it working now.

Thanks,
Yan
Platinum TradePlatinum Trade
This is how it should go on

<aura:component >
    <aura:attribute name="item" type="Camping_Item__c" required="true"
 default="{Name:'ABC', Price__c:100, Quantity__c:1, Packed__c:false}"
/>
    <p>Name
        <!-- <ui:outputText value="{!v.item.Name}"/> -->
        <lightning:input type="text" name="output"  value="{!v.item.Name}" />
        
    </p>
    
    <p>Price
    </p>
    <!-- <ui:outputCurrency value="{!v.Camping_Item.Price__c}"/> -->
    <lightning:formattedNumber value="{!v.item.Price__c}"  style="currency"/>
    
    <p>Quantity
        <!-- <ui:outputNumber value="{!v.Camping_Item.Quantity__c}"/>-->
        <lightning:formattedNumber value="{!v.item.Quantity__c}"/>
    </p>
    
    <p>Packed?:
        <!-- <ui:outputCheckbox value="{!v.Camping_Item.Packed__c}"/> -->
        <lightning:input 	type="toggle"
                         	label="Packed"
							name="togglevalue"
                         	class="myClass"
                         	checked="{!v.item.Packed__c}"
                         />
    </p>
    
</aura:component>