July 2018
Beginner to intermediate
458 pages
9h 58m
English
Attributes are declared in a component's markup. You can treat attributes as similar to Java variables or JavaScript variables. To extract the values from them, we use component.get(), and to set the values, we use component.set().
Let's suppose that you have defined an attribute for a component using aura:attribute, as follows:
<aura:component access="global"> <aura:attribute name="searchTerm" type="String" /></aura:component>
You can get the value of the attribute by using the following:
component.get("v.searchTerm")
To set the value of the attribute, the syntax is as follows:
component.set("v.searchTerm",'Lightning')
Read now
Unlock full access