The Lightning developer guide says that an aura:attribute can contain a List of custom apex type objects, like this:

<aura:attribute name="colorPalette" type="List<docSampleNamespace.Color>" />

However, when I try this, I get this error message:

Message: The value of attribute "type" associated with an element type "null" must not contain the '<' character.: Source

Is this just not implemented yet in the dev preview, or am I doing something wrong?

1 Answer 1


The problem is XML does not allow the use of unescaped < or > characters. In Apex (which is where Lightning Components gets its type system) arrays and lists are equivalent. We typically use array notation in attribute defs because you do not have to &lt; and &gt; encode the []. Try this instead:

<aura:attribute name="colorPalette" type="docSampleNamespace.Color[]"/>
  • 3
    That works, thanks. One thing I eventually figured out is that you need to add the @AuraEnabled keyword to the public variables you want to be able to reference in the custom type class or you just get empty objects.
    – Tom Gersic
    Nov 24, 2014 at 5:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.