About this question
I have seen some uses of {#v.attrib} in a few lightning components, and I'm a person who is used to {!v.attrib}. Is there a difference between them or is there a scenario where '#' has to be used/is better instead of '!'?
I have seen some uses of {#v.attrib} in a few lightning components, and I'm a person who is used to {!v.attrib}. Is there a difference between them or is there a scenario where '#' has to be used/is better instead of '!'?
Log in to share your answer and help other learners.
Log in to answerBest Answer · By JanBask Salesforce Expert
Answered on May 11, 2023
If you want to show a value dynamically based on a aura:attribute, generally we tend to use: {!v.attrib}
Eg:
So if you do cmp.set('v.attrib','test'), then aura:framework automagically does an dirty checking and changes the value accordingly.(Two-way binding)So the label of the is set to test, just think of this as special expression that directly point to the live reference of the attribute in the component(JS perspective), which is quite similar to {{v.attrib}} expression in Angularjs which eventually does the same thing. What if you want to show a value dynamically based on an aura v attribute but it needs to work only once,when it is rendered in the view initially. So you should go with : {#v.attrib} expression, which might improve the performance if there large no.of such [removed]where you don't need such bindings), because it won't be taken into account during dirty checking.AngularJS also has the same one-way binding stuff in its armour : {{::v.attrib}}
Here's a video Mastering Lightning Component - Part 1 on this topic.
hello {#v.test} // print hello world and does not change
hello {!v.test} // prints hello world and 'test' changes based on input value
Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.
Step-by-step Salesforce guides from industry experts
Common Salesforce interview questions, answered
Guides, tips and career advice on Salesforce from JanBask experts.
Salesforce Entry-Level Salesforce Admin Salary: What Can You Expect to Earn?
Curious what an entry-level Salesforce Admin actually earns? See real salary benchmarks by experience and location, plus how to…
Salesforce Senior Salesforce Admin Salary: Salary Range, Factors & Career Growth
What does a senior Salesforce administrator actually earn? See real salary ranges, the skills that boost pay, and how to move up…
Salesforce Cost for Salesforce Certification: Exam Fees by Type, Retakes & Hidden Costs
Salesforce certification exam fees run $75 to $4,500, and most cost $200. See cost by role, retakes, taxes, discounts, and…
Salesforce Salesforce Admin Certification Cost 2026: Exam Fees, Retake & Other Expenses
Learn the Salesforce Admin certification cost in 2026, including the exam fee, retake cost, taxes, discounts, preparation…