You need to sign in to do that
Don't have an account?
shraddha vasu 4
Getting error while previewing the lightning app.
I am new to salesforce.I have created lightning app with no error and when I have tried to preview it I am getting error.Not understanding what it is.Please help me out.
Below are the details of my code and error:-
My lightning component :-myFirstLightComp.cmp
<aura:component>
<aura:attribute name="first_name" type="String" default="shraddha"/>
<aura:attribute name="last_name" type="String" default="vasu" />
<aura:attribute name="result_us_style" type="String" />
<ui:inputText label="Enter your first name" value="{!v.first_name}" />
<ui:inputText label="Enter your last name" value="{!v.last_name}" />
<br />
<ui:button label="submit" press="{!c.doSubmit}" />
<br />
<ui:outputText value="{!v.result_us_style}" />
</aura:component>
My lightning controller:- myFirstLightCompController.js
({
doSubmit: function(component, event, helper) {
console.log(----Start of doSubmit----);
var firstname =component.get("v.first_name");
var lastname=component.get("v.last_name");
var usStyleName=firstname +', '+lastname;
component.set("v.result_us_style" , usStyleName);
console.log("*******Operation success*******and******Result*********"+usStyleName);
console.log(----End of doSubmit----);
}
})
My lightning App:-myFirstLightApp.app
<aura:application>
<c:myFirstLightComp />
</aura:application>
I have registered the domain for this also.
Thanks in advance!!!
Below are the details of my code and error:-
My lightning component :-myFirstLightComp.cmp
<aura:component>
<aura:attribute name="first_name" type="String" default="shraddha"/>
<aura:attribute name="last_name" type="String" default="vasu" />
<aura:attribute name="result_us_style" type="String" />
<ui:inputText label="Enter your first name" value="{!v.first_name}" />
<ui:inputText label="Enter your last name" value="{!v.last_name}" />
<br />
<ui:button label="submit" press="{!c.doSubmit}" />
<br />
<ui:outputText value="{!v.result_us_style}" />
</aura:component>
My lightning controller:- myFirstLightCompController.js
({
doSubmit: function(component, event, helper) {
console.log(----Start of doSubmit----);
var firstname =component.get("v.first_name");
var lastname=component.get("v.last_name");
var usStyleName=firstname +', '+lastname;
component.set("v.result_us_style" , usStyleName);
console.log("*******Operation success*******and******Result*********"+usStyleName);
console.log(----End of doSubmit----);
}
})
My lightning App:-myFirstLightApp.app
<aura:application>
<c:myFirstLightComp />
</aura:application>
I have registered the domain for this also.
Thanks in advance!!!
Greetings to you!
You forget to add double quotes in console.log. Please try below code:
Controller:
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
All Answers
Greetings to you!
You forget to add double quotes in console.log. Please try below code:
Controller:
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
Thanks much!!
It worked :-)
Yeah, I forgot to add double quotes there.
Regards,
Shraddha