SALESFORCE LIGHTNING EXPRESSION

salesforce lightning expression

SALESFORCE LIGHTNING EXPRESSION

So far we have discussed salesforce lightning component composition.
In this episode, we are gonna discuss about how to use salesforce lightning expression while creating a lightning component.
So what exactly lightning expression is ?
Lightning Expression allows you to make calculations and access property value.
In a simple way, It helps you to get the value, to make some calculation with that.
The expression is evaluated and dynamically replaced when the component is evaluated.
The syntax of the lightning expression is :
=============================================
{!<expression>}                              For Example : {!v.num}
=============================================

As you are familiar with {!v.xxxx} this syntax while creating a lightning component.
Now there are some rules for using expression while creating a lightning component.

RULES FOR USING THE EXPRESSION :

You can only use {!} Syntax in markup languages like HTML, hence in .app and .cmp  we are using {!} for expression.
In JavaScript, we use string syntax to evaluate an expression.
For Example :
=============================================
var label = cmp.get("v.label"); 
=============================================

Above code will get the value present in the label which is a reference to attribute defined in aura component.

Also, you don't have to use {!} while defining the expression in javascript.

Coool !! Now, whenever you use expression while creating the lightning component you will take care of these rules.

WOHOOO !! YOU HAVE JUST COMPLETED LIGHTNING EXPRESSION EPISODE
If you like this salesforcekid learning platform please let me know in the Comment section...Also, Share with your salesforce folks wish you 
Happy learning ☁️⚡️ (Learn. Help. Share.)


<< PREVIOUS                                                        NEXT >>

SALESFORCE LIGHTNING EXPRESSION SALESFORCE LIGHTNING EXPRESSION Reviewed by on Rating: 5

No comments:

HELP !! SHARE !! SUGGEST !!

Powered by Blogger.