Aura Attribute
====================================================================
An aura attribute is like a variable that we use in a programming language or in Apex class. These are typed fields and set on a specific instance of a component. These attributes can be used inside the component as expressions and in controller and helper as well.
Types of Attributes
=====================================================================
A: Basic Types:
---------------------------------
These are the basic attributes that contain values of primitive types like integer, string, boolean etc.
1. String :- It stores simple text values like color, name etc.
2. Boolean :- It stores boolean values like true or false.
3. Decimal :- It stores values with fractional part. Used to store values like price.
4. Integer :- It stores integer/Number values like quantity etc.
5. Double :- It stores fractional values like price, currency values.
6. Date :- It stores date values in yyyy-mm-dd format.
7. DateTime :- It stores date values with timestamp.
8. Long :- It stores non fractional values with wider range than integer.
2. Boolean :- It stores boolean values like true or false.
3. Decimal :- It stores values with fractional part. Used to store values like price.
4. Integer :- It stores integer/Number values like quantity etc.
5. Double :- It stores fractional values like price, currency values.
6. Date :- It stores date values in yyyy-mm-dd format.
7. DateTime :- It stores date values with timestamp.
8. Long :- It stores non fractional values with wider range than integer.
B: Collection Types:
--------------------------------
Lightning supports the collection type attributes like an array, list and map.
- Array : An array of items of a defined type
- List: An ordered collection of items.
- Map: A collection that maps keys to values. A map can’t contain duplicate keys. Each key can map to at most one value. Defaults to an empty object, {}.
- Set: A collection that contains no duplicate elements. The order for set items is not guaranteed. For example, “[‘red’, ‘green’, ‘blue’]” might be returned as blue, green, red.
Attributes of these types are typically used in iterations in lightning to display data.
C: Object Types
-----------------------------------
An attribute can have the type as “Object”. The object is stored in JSON format.
D: Apex Class Types
-----------------------------------
An attribute can have the type as “Apex Class”.
Its really an Excellent post.
ReplyDeleteSalesforce Consulting Services