Angular · Junior · Question 64 of 75
What is @let used for in a template?
@let total = price() * quantity();
<p>Total: {{ total }}</p>- ✓Correct answer: Declaring a local read-only variable that can be reused in the template
- 2Declaring a mutable variable that inputs can change
- 3Importing a value from the component class
Explanation
@let avoids repeating long expressions or several async pipes. The value is recalculated whenever the template is checked.