Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Using JavaScript

Use JavaScript for client-side code. The $A namespace is the entry point for using the framework in JavaScript code.

For all the methods available in $A, see the JavaScript API.

A component bundle can contain JavaScript code in a client-side controller, helper, or renderer. Client-side controllers are the most commonly used of these JavaScript resources.

Expressions in JavaScript Code

In JavaScript, use string syntax to evaluate an expression. For example, this expression retrieves the label attribute in a component.

1var theLabel = cmp.get("v.label");

Only use the {! } expression syntax in markup in .app or .cmp resources.

Note