Reputation: 7165
I recently released a new component and it seems to be triggering change detection multiple times a second:
// some debugging code
ngDoCheck() {
console.log('DO_CHECK', new Date().toLocaleTimeString());
}
Results:
I've yet to figure out what is triggering this.
Am I reading this output correctly? Change detection is being triggered multiple times a second?
Is there any good method for figuring out what is triggering change detection in an Angular 2 application?
Upvotes: 12
Views: 3896
Reputation: 503
The Angular DevTools for Chrome provide a profiler that will list all change detection events and will show the source for each event.
Upvotes: 1