Using Expression syntax

The syntax for the Expression is {!expression}. The Expression syntax can be used inside the Component Markup. Let's take a look at the following table to see the syntax for Expressions in different scenarios:

Expression Example Syntax Example Code
Expression to reference a value from an attribute {!v.attributeName}
<aura:component>    <aura:attribute name="searchString" type="String" default="lighnting components"/>        <p>{!v.searchString}</p></aura:component>
Expression for calling client-side controller actions {!c.handleClick}
<Lightning:button label="Framework Button" onclick="{!c.handleClick}"/>The client-side JavaScript controller will be as following({    handleClick : function(component, event) {            }})

Get Learning Salesforce Lightning Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.