Activity › Forums › Salesforce® Discussions › What is attribute in Salesforce Lightning?
Tagged: Apex, Attributes, Fields, Lightning Code, Salesforce Attribute, Salesforce Lightning Component, Variable
-
What is attribute in Salesforce Lightning?
Posted by Ayush on January 30, 2020 at 1:02 PMWhat is attribute in Salesforce Lightning?
Manish replied 6 years, 3 months ago 6 Members · 5 Replies -
5 Replies
-
It is like a member variable in our regular coding. In others words, attributes are used to store information to be referenced and used in our lightning component code.
It will make your lightning component more dynamic.
- [adinserter block='9']
-
Component attributes are like member variables on a class in Apex. They are typed fields that are set on a specific instance of a component, and can be referenced from within the component’s markup using an expression syntax. Attributes enable you to make components more dynamic.
-
Hi Ayush,
Attribute is generally used as a variable in Salesforce Lightning Component to hold value/information
-
Attribute : It is used to store information to be referenced in our lightning component code. Attributes on components are like instance variables in objects. It have a name and a type.
<aura:attribute> tag is used to add an attribute to the component.
Example :
<aura:component> <aura:attribute name="message" type="String"/> <p>{!'Hello! ' + v.message}</p> </aura:component> -
Hi Ayush
Attribute is an lightning component, and used to declare variables in same way as we declare in apex:
Example: <aura:attribute name=”accObj” type=”String” description=”account Object” access=”public” default=”{‘sobjectType’: ‘Account’, ‘Name’: ”, ‘Website’: ”, ‘Phone’: ”, ‘Description’: ”, ‘Industry’: ”}” />
public static Account accObj;
Log In to reply.