Newer Version Available

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

createComponents()

Create an array of components from a list of types and attributes. This method accepts a list of component names and attribute maps, and a callback to notify the caller.

Signature

createComponents(Array components, function callback)

Parameters

components
Type: Array
The list of components to create. For example, ["lightning:button", {"onclick":component.getReference("c.handlePress")}]
callback(components, status, errorMessage)
Type: function
The callback to invoke after the components are created. The callback has three parameters.
  1. components—The components that were created. This parameter enables you to do something with the new components, such as add them to the body of the component that created them. If there’s an error, components is null.
  2. status—The status of the call. The possible values are SUCCESS, INCOMPLETE, or ERROR. Always check that the status is SUCCESS before you try to use the components.
  3. errorMessage—The error message if the status is ERROR.