Category: Uncategorized

Lightning: $A

$A is known as the Aura object. Aura object is top level object in javaScript framework code.

Usage of $A

// Find a component where you wan to apply the util
var myAttr = component.find("myAttr"); 
$A.util.addClass(myAttr, "add-class");

Can be used with –

getBooleanValue
hasClass
isArray
isEmpty
isObject
isUndefined
isUndefinedOrNull
removeClass
toggleClass

More reference can be found on – https://na15.lightning.force.com/auradocs/reference.app

Lightning: Action Handlers

Action handlers are just JavaScript functions with a particular function signature.

Action handlers are also known as –
1. controller action
2. controller function

Declaring an Action Handler –

For example you have Action Handler named handleClick

handleClick: function(component, event, helper)

3 parameters that are part of this Action Handler are –

1. component – The component which called this Action Handler.
2. event – The event which caused this Action Handler to be called.
3. helper – the component’s helper, another JavaScript resource of reusable functions.