Activity Forums Salesforce® Discussions What is the difference between bound and unbound expressions in Salesforce? Reply To: What is the difference between bound and unbound expressions in Salesforce?

  • Parul

    Member
    September 21, 2018 at 10:21 am

    Hi

    Unbound Expression: Unbound Expression is represented as {#v.messageText}. Whenever the value of the string is changed, this expression will not reflect the change, we can say the value remains static through this expression.

    Bound Expression: Bound Expression is represented as {!v.messageText}. Whenever the value of the string is changed, this expression will reflect the change and also affect the components where it is used, we can say the value change dynamically through this expression.

     

    Example :

    <aura:component implements=”force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction” access=”global” >
    <aura:attribute name=”str” type=”string” default=”Hello World!”/>
    <ui:outputText value=”Enter a string value : “/><ui:inputText value=”{!v.str}”/>
    <br/><br/>
    <ui:outputText value=”{#v.str}”/>
    <br/><br/>
    <ui:outputText value=”{!v.str}”/>
    </aura:component>

    Thanks.