Hello.
I recently started to learn Angular and have some problem with understanding it's behavior.
For example, I have a simple component like this one.
When I reload the page I see the console printing 'logged in' 6 times. I checked the debugger and all the calls are in fact from the template.
Is this a normal behavior with Angular change detection that it keeps refreshing the whole template every time something is changing in any part of it or in any of child components or is it something else?
Thank You.
#Template gets refreshed multiple times
3 messages · Page 1 of 1 (latest)
Just because it's evaluating expressions doesn't mean it's refreshing the whole template. On the contrary. Change detection is precisely there to test if the expressions have changed. The view is only updated if it needs to be, i.e. the value of the expressions it displays have changed.
So yes, it's normal behavior.
Got it. Thank You for the info 🙂