I was going through some articles on change detection and i was trying to enable or disable change detection using the changeDetectorRef.detach()
and changeDetectorRef.reattach()
.
I also hooked the component to the ngDoCheck()
only to find ngDoCheck()
being called even after detach()
.
What am i doing wrong ? Can someone explain why ngDocheck()
is called ?
I have even the ChangeDetectionStartegy
set to OnPush
too .
This is the article i was going through to understand change detection
I have also created an example for this : https://stackblitz.com/edit/angular-4ytdbs