What does ExpressionChangedAfterItHasBeenCheckedError mean and how do you fix it?
Model answer
In development mode, Angular runs a second check to be sure bindings did not change during change detection. This error means a value used in a template changed after Angular had already checked it, for example a child changing a parent's data in ngAfterViewInit.
Fix the data flow: set the value earlier (ngOnInit), use a signal or computed, move the logic to where it belongs, or schedule a deliberate update. Hiding it with a timeout is a last resort, because it covers up a design problem.
Learn this topic
Angular Tutorial: Beginner to Advanced .
Sign in to add your own answer.