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

Lighting Components Basic - Null value being passed to lightning 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:

campingList.cmp
campingListItem.cmp - I significantly simplified the code here already for debugging.
The error I get is the following:
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 your child component, you have not used v.attribute_name to display the values throughout the component. Use expressions as {!v.item.Name}.
It will solve your issue.
Please make it as best answer if it is helpful.
All Answers
campingHeader.cmp (called by TestCamping.app) campingList.cmp campingListController.js
CampingListController.apxc
campingListItem.cmp
campingListItemController.js
With the above code, I get the following error. I don't even get to the point where I can enter any additional items using the form.
Thank you,
Vipul
cmp > campingList.cmp
@naveenkn55
In your child component, you have not used v.attribute_name to display the values throughout the component. Use expressions as {!v.item.Name}.
It will solve your issue.
Please make it as best answer if it is helpful.