I am having a similar code and error as Expression ___ has changed after it was checked where I am changing a variable value in ngAfterViewInit()
.
One of the answers https://stackoverflow.com/a/35243106/1460595 suggests to manually trigger change detection by calling detectChanges()
method of ChangeDetectorRef
, which works.
But why do we have to handle change manually when Angular 2 should be handling the change?
Is there some relationship between lifecycle hooks and change detection?