Newer Version Available

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

Using JavaScript

Use JavaScript for client-side code. The Aura object is the top-level object in the JavaScript framework code. For all the methods available in the Aura class, see the JavaScript API at https://<mySalesforceInstance>.lightning.force.com/auradocs/reference.app, where <mySalesforceInstance> is the name of the instance hosting your org; for example, na1.

$A is the shorthand in JavaScript code for the Aura object.

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.

1swfobject.registerObject("clippy.codeblock-0", "9");var theLabel = cmp.get("v.label");

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

Note