+ Start a Discussion
Tomasz J. OmelczukTomasz J. Omelczuk 

Create a HelloWorld Lightning Component issue

Welcome all,

I try to pass module Create a HelloWorld Lightning Component  but I'm facing following error: "Challenge Not yet complete... here's what's wrong: The 'HelloWorld' component does not contain the correct code." however I cannot find this error here are my codes 

helloWorld.cmp:
<aura:component controller="HelloWorldController" implements="flexipage:availableForAllPageTypes"> 
<aura:attribute name="greeting" type="String" default="World" />
<lightning:input name="Greeting" label="Greeting" value="{!v.greeting}"/>
 <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
 Hello, {!v.greeting}!
</aura:component>

apex HelloWorldController : 
public with sharing class HelloWorldController {
@AuraEnabled
public static User getCurrentUser() {
return [SELECT Id, FirstName, LastName FROM User WHERE Id = :UserInfo.getUserId() LIMIT 1];
 }
 }

and js HelloWorldController:
({
doInit : function(component, event, helper) {
var action = component.get("c.getCurrentUser");
action.setCallback(this, function(response) {
var user = response.getReturnValue();
component.set("v.greeting", user.FirstName);
})
$A.enqueueAction(action);
}
})

The worst thing in this situation is that I check in my org and everything works as it should. 
Best Answer chosen by Tomasz J. Omelczuk
sfdcMonkey.comsfdcMonkey.com
Hi , update your lightning component with below code once :
<aura:component controller="HelloWorldController"   implements="flexipage:availableForAllPageTypes,force:hasRecordId"> 
  <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
  <aura:attribute name="greeting" type="String" default="World" />

<lightning:input name="Greeting" label="Greeting" value="{!v.greeting}"/>
  Hello, {!v.greeting}!
</aura:component>
and check again , if you still getting same error, logout from trailhead and login again after clear browser cache and recheck 

i hope it helps you.
      Let me inform if it helps you and kindly mark it best answer if it helps you so it make proper solution for others
    thanks 
http://sfdcmonkey.com  (http://sfdcmonkey.com )
 

All Answers

sfdcMonkey.comsfdcMonkey.com
Hi , update your lightning component with below code once :
<aura:component controller="HelloWorldController"   implements="flexipage:availableForAllPageTypes,force:hasRecordId"> 
  <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
  <aura:attribute name="greeting" type="String" default="World" />

<lightning:input name="Greeting" label="Greeting" value="{!v.greeting}"/>
  Hello, {!v.greeting}!
</aura:component>
and check again , if you still getting same error, logout from trailhead and login again after clear browser cache and recheck 

i hope it helps you.
      Let me inform if it helps you and kindly mark it best answer if it helps you so it make proper solution for others
    thanks 
http://sfdcmonkey.com  (http://sfdcmonkey.com )
 
This was selected as the best answer
Omar Bensouda Korachi 5Omar Bensouda Korachi 5
Hi {!Piyush_soni__c}
Is not working for me. Have any other suggestion ? 

 
Josué PeixotoJosué Peixoto
<aura:component controller="HelloWorldController" implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
  <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
  <aura:attribute name="greeting" type="String" default="World" />
<lightning:input name="Greeting" label="Greeting" value="{!v.greeting}"/>
  Hello, {!v.greeting}!
</aura:component>

please respond with jewel if it worked.
Kiran ThanuKiran Thanu
how ever my functionality is working im not able to complete.. but with this code im done with my challenge.