Newer Version Available

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

Function Type

An attribute can have a type corresponding to a JavaScript function. If a child component has an attribute of this type, you can pass a callback from a parent component that contains the child component.
1<aura:attribute name="callback" type="Function" />

For an example of using this type with aura:method, see Return Result for Asynchronous Code.

Don’t send attributes with type="Function" to the server. These attributes are intended to only be used on the client side.

The most robust way to communicate between components is to use an event. If you get an error in a component with an attribute of type Function, fire an event in the child component instead and handle it in the parent component.

Note