Component

Component contains methods to work with components.

Methods 

  • addEventHandler()

    Dynamically adds an event handler for a component or application event.

  • addHandler()

    Deprecated. Use addEventHandler() instead.

  • addValueHandler()

    Adds handlers to values owned by the component.

  • addValueProvider()

    Adds custom value providers to a component.

  • autoDestroy()

    Sets a flag to tell the rendering service whether or not to destroy this component when it is removed from its rendering facet.

  • clearReference()

    Clears a live reference for the value passed in using property syntax. For example, if you use aura:set to set a value and later want to reset the value using component.set(), clear the reference before resetting the value.

  • destroy()

    Destroys the component and cleans up memory. After a component that is declared in markup is no longer in use, the framework automatically destroys it and frees up its memory. If you create a component dynamically in JavaScript and that component isn’t added to a facet (v.body or another attribute of type Aura.Component[]), you have to destroy it manually using destroy() to avoid memory leaks.

  • find()

    Locates a component using its local ID (aura:id).

  • get()

    Returns the value referenced using property syntax. For example, cmp.get("v.attr") returns the value of the attr attribute.

  • getConcreteComponent()

    Gets the concrete implementation of a component. If the component is concrete, the method returns the component itself. For example, call this method to get the concrete component of a super component.

  • getElement()

    If the component renders only a single element, return it. Otherwise, use getElements().

  • getElements()

    Returns a map of the elements rendered by the component.

  • getEvent()

    Returns a new event instance of the named component event.

  • getGlobalId()

    Gets the global ID, which is the generated globally unique id of the component. It can be used to locate the instance later, but will change across page loads.

  • getLocalId()

    Gets the ID set using the aura:id attribute. Pass the local ID into find() on the parent component to locate this child component.

  • getName()

    Returns the component’s code-compatible camel case name, such as 'lightningButton'.

  • getReference()

    Returns a live reference to the value indicated using property syntax. This method is useful when you dynamically create a component.

  • getSuper()

    Returns the super component.

  • getType()

    Returns the component’s canonical type; for example, 'lightning:button'.

  • getVersion()

    Returns the component’s version number.

  • isConcrete()

    Returns true if the component is concrete, or false otherwise. A concrete component is a sub-component in an inheritance chain.

  • isInstanceOf()

    Checks whether a component is an instance of the given component or interface name.

  • isValid()

    Returns true if the component has not been destroyed.

  • removeEventHandler()

    Dynamically removes a component event handler for the specified event.

  • set()

    Sets the value referenced using property syntax.