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

Lightning Component Questions
I am just starting through the Lightning Components Basics Trailhead. I have a few questions. The first is, how do you pass data or get data to a component? For example, I am working on the Handle Actions And Conrollers module. I built the 'campingListItem Component and Controller but there is no data that shows when I launch the component. Maybe I'm not there yet but I'm confused how you pass data to the component.
The second question I have is specifically about the challenge for the 'Handle Actions and Controllers" Module. I completed it successfully, but I'm not sure if what I have is the most efficent way to go about it. I am pasting my controller below. The first variable is pulling in the button so I can disable it (btnClicked) The second variable is getting the item and updating fields form that item.
Thank you!!!
Fred
var btnClicked = event.getSource();
btnClicked.set("v.disabled",true);
var a = component.get("v.item",true);
a.Packed__c = true;
component.set("v.item",a);
The second question I have is specifically about the challenge for the 'Handle Actions and Controllers" Module. I completed it successfully, but I'm not sure if what I have is the most efficent way to go about it. I am pasting my controller below. The first variable is pulling in the button so I can disable it (btnClicked) The second variable is getting the item and updating fields form that item.
Thank you!!!
Fred
var btnClicked = event.getSource();
btnClicked.set("v.disabled",true);
var a = component.get("v.item",true);
a.Packed__c = true;
component.set("v.item",a);
1) Yes, you have to wait for the module in which they explain how to retrieve data from the server. Basically you have to create an @auraenabled method in the server controller, call it from your javascript controller and set the data in the value provider.
2) There are other options that would work, but unfortunately Trailhead only detects that one as valid. Other option could be:
component.set("v.item.Packed__c",true);
Regards.
All Answers
1) Yes, you have to wait for the module in which they explain how to retrieve data from the server. Basically you have to create an @auraenabled method in the server controller, call it from your javascript controller and set the data in the value provider.
2) There are other options that would work, but unfortunately Trailhead only detects that one as valid. Other option could be:
component.set("v.item.Packed__c",true);
Regards.