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 at https://<myDomain>.lightning.force.com/auradocs/reference.app, where <myDomain> is the name of your custom Salesforce domain.

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.

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

Note

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