Angular · Junior · Question 16 of 75

Why should template expressions be simple and free of side effects?

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.

Further reading

Problem with a question

Angular · Junior · question 16

Test yourself

Take the Angular · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz