Newer Version Available

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

Value Providers

Value providers are a way to access data. Value providers encapsulate related values together, similar to how an object encapsulates properties and methods.

The most common value providers are v and c, as in view and controller.

Value Provider Description
v A component’s attribute set
c A component’s controller with actions and event handlers for the component

All components have a v value provider, but aren't required to have a controller. Both value providers are created automatically when defined for a component.

Values in a value provider are accessed as named properties. To use a value, separate the value provider and the property name with a dot (period). For example, v.body.

Expressions are bound to the specific component that contains them. That component is also known as the attribute value provider, and is used to resolve any expressions that are passed to attributes of its contained components.

Note

Accessing Fields and Related Objects

When an attribute of a component is an object or other structured data (not a primitive value), access the values on that attribute using the same dot notation.

For example, {!v.accounts.id} accesses the id field in the accounts record.

For deeply nested objects and attributes, continue adding dots to traverse the structure and access the nested values.