In this exercise, you will learn how to:
<aura:component> ... </aura:component>
tags.Click the Save button.
Since this is the first time we’ve modified the standard Property page, we need to activate the updated page so that our users can see what we’ve done.
class="slds-card"
assigned to the <article>
tag in the code sample.class="slds-card"
to the <div>
tag.Save the file and reload the Property Detail page.
class="slds-card__body slds-card__body_inner"
applied to the last <div>
.<div class="slds-card__body slds-card__body_inner">
.slds-p-top_medium
to the second <div>
so that it looks like this <div class="slds-card__body slds-card__body_inner slds-p-top_medium">
.Save the file and refresh the Property Detail page.
Hello, {!v.greeting}!
.Add a new line on line 2, and add:
<aura:attribute name="greeting" type="String" default="World" />
Add the following input field on a new line below the Hello {!v.greeting}
:
<input aura:id="myInput" type="text" />
<button name="Update" type="submit">Update</button>
slds-input
class applied to the <input>
tag.class="slds-input"
to the <input>
tag in the Developer Console.class="slds-button slds-button_brand"
from the code sample and add it to the <button>
in the Developer Console.slds-m-top_small
to the button’s list of classes.Save the file and reload the Property Detail page.
onclick="{!c.updateValue}"
to the <button>
in the Developer Console.Add the following to the updateValue function:
var val = component.find("myInput").getElement().value;
component.set("v.greeting", val);
Type your name into the input and click the Update button.
class="slds-input"
from the <input>
.Add lightning:
to the word <input>
and add value="{!v.greeting}"
so that it is now:
<lightning:input aura:id="myInput" type="text" value="{!v.greeting}" />
<button>
from the component.Not working for you? Your finished HelloWorld component should be as follows:
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
<aura:attribute name="greeting" type="String" default="World" />
<div class="slds-card">
<div class="slds-card__body slds-card__body_inner slds-p-top_medium">
Hello, {!v.greeting}
<lightning:input aura:id="myInput" type="text" value="{!v.greeting}" />
</div>
</div>
</aura:component>
({
updateValue : function(component, event, helper) {
var val = component.find("myInput").getElement().value;
component.set("v.greeting", val);
}
})