• Vipul Dalal 19
  • NEWBIE
  • 15 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
In the "Input Data Using Forms", I am getting NULL pointer error when I call "campingListItem" LIghtning component and I can't seem to figure out why.  In the loop below, I am able to successfully view the values of the "item" right before passing it into the campingListItem component.  

The error I get is the following:
Error

campingList.cmp
 
<aura:component controller="CampingListController">

    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    
    
    <aura:attribute name="items" type="Camping_Item__c[]"/>
    
........removed code showing form to enter new items as NewItem......
    
    <lightning:card title="Camping Items">
        <p class="slds-p-horizontal--small">
            
            
            <aura:iteration items="{!v.items}" var="item">
                <!-- I CAN SUCCESSFULLY SEE THE FOLLOWING 3 VALUES -->
				{!item.Name}, {!item.Quantity__c}, {!item.Price__c} 
                
                <c:campingListItem item="{!item}"/>
            </aura:iteration>
            
        </p>
        
    </lightning:card>
</aura:component>

campingListItem.cmp - I significantly simplified the code here already for debugging.
 
<aura:component >
    
    <aura:attribute name="item" type="Camping_Item__c"/>
    
    <tr>
        <td><ui:outputText value="{!item.Name}"/></td>
    </tr> 
        
</aura:component>

 
In the "Input Data Using Forms", I am getting NULL pointer error when I call "campingListItem" LIghtning component and I can't seem to figure out why.  In the loop below, I am able to successfully view the values of the "item" right before passing it into the campingListItem component.  

The error I get is the following:
Error

campingList.cmp
 
<aura:component controller="CampingListController">

    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    
    
    <aura:attribute name="items" type="Camping_Item__c[]"/>
    
........removed code showing form to enter new items as NewItem......
    
    <lightning:card title="Camping Items">
        <p class="slds-p-horizontal--small">
            
            
            <aura:iteration items="{!v.items}" var="item">
                <!-- I CAN SUCCESSFULLY SEE THE FOLLOWING 3 VALUES -->
				{!item.Name}, {!item.Quantity__c}, {!item.Price__c} 
                
                <c:campingListItem item="{!item}"/>
            </aura:iteration>
            
        </p>
        
    </lightning:card>
</aura:component>

campingListItem.cmp - I significantly simplified the code here already for debugging.
 
<aura:component >
    
    <aura:attribute name="item" type="Camping_Item__c"/>
    
    <tr>
        <td><ui:outputText value="{!item.Name}"/></td>
    </tr> 
        
</aura:component>