Aura Supported Attributes- Part 2
We looked at some basic attribute types in my last post. Now lets look at other attribute types that are available for Lightning Components development
- Object Types: This attribute type is declared as a type 'Object' and used for passing any type of event parameter's like Array of String, Array of Integer, etc.,
Object Type Attribute: <aura:attribute name="objTypeAttr" type="Object" default="['Test1', 'Test2']" />
- Standard and Custom Object Types: This extends above attribute types in order to be able to use both Standard and Custom Objects
Standard Object Attribute: <aura:attribute name="standObj" type="Account" />
Custom Object Attribute: <aura:attribute name="cstmObj" type="Expense__c" />
- Collection Types: We have Four collection attribute types for use [Type[], List, Set, and Map]
- Custom Apex Class Type: This attribute type is helpful to access all Apex Class Methods however all methods need to be annotated as @AuraEnabled prior using them in Lighting Components
Custom Apex Class Attribute: <aura:attribute name="apexClassAttr" type="{Class_Name}">
- Framework-Specific Types: This attribute type is to embed a Component within an attribute. Here we have two types
a. Aura.Component - This is a single Component however Salesforce recommends using Aura.Component[] instaead]
b. Aura.component[] - This is a List of Components
Hope you like this post and any kind of feedback or corrections are always welcome - Thanks!
Comments
Post a Comment