Angular · Junior · Question 16 of 75
Why should template expressions be simple and free of side effects?
- ✓Correct answer: They are re-evaluated on every change detection run, so heavy or mutating logic slows the app and causes bugs
- 2Angular templates do not support function calls at all
- 3Complex expressions are only executed on the server
Explanation
Calling getTotal() in a template runs it during every check. Prefer fields, computed() signals or pure pipes for derived values, and keep logic in the class.