Please explain to me why I keep getting this error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked.
Obviously,
Angular runs change detection and when it finds that some values which has been passed to the child component have been changed, Angular throws the following error:
ExpressionChangedAfterItHasBeenCheckedError click for more
In order to correct this we can use the AfterContentChecked life cycle hook and
import { ChangeDetectorRef, AfterContentChecked} from '@angular/core';
constructor(
private cdref: ChangeDetectorRef) { }
ngAfterContentChecked() {
this.cdref.detectChanges();
}