You need to sign in to do that
Don't have an account?
Dr. Who
TrailHead Lightning 'Apex in components' challenge
This client-side DisplayCaseController does not pass the challenge with error "The client side controller does not refer to the 'getCaseFromId' method of the Apex controller class". Component and controller are pasted below. The component runs from a test lighnting app. getCaseFromId is correctly referenced as "var action = component.get("c.getCaseFromId");" in the first line of code
component
component
<aura:component controller="DisplayCaseController" > <aura:attribute name="record" type="Case"/> <ui:inputText aura:id="caseId" label="Enter Case Id: "/> <ui:button label="Get Case" press="{!c.getCaseRecord}"/><br/> Subject: <ui:outputText value="{!v.record.Subject}"/><br/> Description: <ui:outputText value="{!v.record.Description}"/><br/> Status: <ui:outputText value="{!v.record.Status}" /><br/> </aura:component>client-side controller
({ getCaseRecord : function(component) { var action = component.get("c.getCaseFromId"); var caseId = component.find("caseId").get("v.value"); action.setParams({ "caseID" : caseId }); action.setCallback(this, function(action) { if (action.getState() === "SUCCESS") { component.set("v.record", action.getReturnValue()); } else { alert("Action state: " + action.getState()); } }); $A.enqueueAction(action); } })Test Application
<aura:application> <c:DisplayCase/> </aura:application>
All Answers
Only difference I see between what I have (which passed) and yours are the brackets shown below:
Yours: Mine:
Not sure if those make a difference, but the rest of what you have makes sense. Technically, you don't need any of the following in the client-side controller since the Apex class handles null for ID input:
This works in the client-side controller for me:
Thanks,
Phil