Newer Version Available

This content describes an older version of this product. View Latest

Custom Apex Class Types

An attribute can have a type corresponding to an Apex class. For example, this is an attribute for a Color Apex class:

1swfobject.registerObject("clippy.codeblock-0", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17<aura:attribute name="color" type="docSampleNamespace.Color" />
18

Using Arrays

If an attribute can contain more than one element, use an array.

This aura:attribute tag shows the syntax for an array of Apex objects:

1swfobject.registerObject("clippy.codeblock-1", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17<aura:attribute name="colorPalette" type="docSampleNamespace.Color[]" />
18

Make your Apex class methods, getter and setter methods, available to your components by annotating them with @AuraEnabled.

Note