2 years ago
#16836
Cory
Why is it considered a code smell to call detectChanges()?
I recently reviewed some code where detectChanges
is called. I've read all over the place that manually running a change detection cycle is a code smell and a sign that you are probably doing something wrong. I've personally never had to use it in this project, but I can't really argue WHY it's bad. The best I can come up with is "You shouldn't be manually doing what Angular does automatically", but I want to have a better answer than that. What could go wrong if I call detectChanges
? Can you provide some examples?
angular
angular2-changedetection
angular-changedetection
0 Answers
Your Answer