In 2026, a chart in an Angular admin modal just appeared and the console logs ExpressionChangedAfterItHasBeenCheckedError—is the size write-back one cycle late?
Bottom line first: this error usually does not mean Angular itself is broken. It means that, within the same change detection cycle, a value used in a template binding was changed again after it had already been checked. In development mode, Angular runs another verification pass, and if the before and after values do not match, it throws ExpressionChangedAfterItHasBeenCheckedError. In 2026 projects, common trigger points are synchronously changing bound values in ngAfterViewInit or ngOnChanges, or a getter or pipe in the template returning a new object every time. In most cases, adjusting when the value is read or changing the data flow can eliminate it; you do not always need to suppress it with setTimeout.
1. What this error is saying: an “after-the-fact change” was caught
Angular change detection runs one top-down pass, compares the values read in the template with the previous values, and writes the results into the view. In a development build, it then immediately runs another verification pass: if a binding expression was changed after the previous pass ended, it throws this error. In other words, what it catches is not that the value was written incorrectly, but that the value changed again after this cycle.
This step runs only in development builds; production builds do not perform the second verification by default. So some teams stop seeing this error after release and assume there is no issue, but the synchronous value-changing logic that caused it is still there; it just no longer reports an error. What may show up instead is a brief layout flicker, a width or height calculated incorrectly once, or a block on the first screen aligning one frame late.
- The error message usually includes an expression fragment. First check which template it belongs to and whether it is an interpolation or an @Input.
- It is often intermittent, because it triggers only when the data happens to change in that exact cycle; reproduction steps may not be stable.
- It is not a memory leak, nor is it a performance bottleneck, but repeated triggering slows down hot reload and debugging during development.
2. Three common trigger sources: identify the pattern before changing code
Synchronously changing values inside lifecycle hooks
ngAfterViewInit is a high-frequency area. At this point the child view has already been checked; if you synchronously change a value passed in from the parent or a value bound to the template there, the next verification pass may not match. The same category includes taking an input in ngOnChanges, calculating a derived value again, and writing it back to a template binding.
A function called in the template returns a new object every time
If you write a getter in the template or directly call a method that returns a new array, it re-executes on every change detection pass; if it returns a new reference, comparison with list rendering or object-type @Input can easily go wrong. This type of issue has a characteristic: the error follows the number of renders, not user actions. One scroll or mouse movement can produce another line in the console.
A child component writes back to the parent after view initialization
A child component emits a measured value in ngAfterViewInit, such as width, height, or scroll position; the parent receives it and assigns it to a template binding, exactly after the parent has already been checked. Components that need real dimensions, such as charts, maps, and virtual lists, often hit this case.
3. Troubleshoot in three steps: who changed it, when it was changed, and whether it can wait one cycle
Rather than commenting things out one by one and trying again, fix a sequence. The three steps below are fairly general in projects; following them in order usually locates the specific line within ten-plus minutes, saving time compared with adding delays aimlessly.
- See which template the expression lives in: search for the binding name from the error in the template and confirm whether it is an interpolation, an @Input, or a condition in conditional rendering.
- Trace who wrote it in this cycle: follow the @Input chain or a subject in a service upward, and confirm in which lifecycle hook or event callback the most recent assignment happened.
- Decide whether it can wait one cycle: if the value affects only visuals, such as width, animation, or scroll position, it can be moved to the next cycle or replaced with a size-observation API; if it participates in business decisions, the data flow needs to change and cannot be delayed.
The third step is the dividing line. If it can wait one cycle, change the timing; if it cannot, change the structure. A lot of rework comes from throwing business decisions into a delayed callback as well, which scrambles the logic order and makes later troubleshooting more expensive. From experience, locating by binding name first and then tracing back along the assignment chain saves more time than starting from lifecycle hooks and setting breakpoints one by one.
4. Trade-offs among four fixes: work around it or address the root cause
The same error can be handled in very different ways. Below is a comparison by amount of change, risk, and typical experience range; effort varies with project size, component complexity, and familiarity, and should not be treated as a fixed quote.
- Move the timing; usually the first choice: move the assignment from ngAfterViewInit to ngOnInit, or switch to a size-observation callback or an after-render callback. Experience range is about 0.5–2 hours per occurrence; risk is low, suitable for values that affect only visuals.
- Change the data flow; closer to a root fix: turn the derived value into a computed value, or calculate it before the data enters the component so the template no longer calls a function. Experience range is about 0.5–1 day; risk is medium, suitable for values that participate in business decisions.
- Trigger change detection manually in a local scope: when you have confirmed it affects only the current child component, call detectChanges or markForCheck. Experience range is a few minutes to half an hour; risk is medium, and overuse can hide the real dependency relationships.
- Wrap it in a delay; more of a workaround: push the change to the next macrotask. Experience range is a few minutes to half an hour; risk is high, it adds another render, animation and size-measurement scenarios may flicker, and it easily turns into wrapping delays everywhere.
The judgment standard can be simple: after the fix, if the trigger path of this logic can be written into a comment or commit message, it passes; the next person adding a binding will not have to step on it again. If it cannot be explained clearly, it is probably a workaround rather than a solution.
5. Delivery context: repeated errors often come from third-party components
According to the typical range in 2026 projects, when this type of error appears in batches, the root cause is often not business code but embedded charts, maps, and rich-text editors. The constraints are also very real: the container width in the design file is not final, the page must adapt to screens from 1366 to 2K at the same time, and the integration window is only one or two days. The usual approach is to move size measurement from ngAfterViewInit to a size-observation callback, with the parent writing back only when the size actually changes; the cost is an extra round of testing at extreme resolutions and roughly half a day to one day of rework. When done, lock down three acceptance criteria: no new errors when switching routes, no new errors when dragging the window, and no visual jump in the same scenario under a production build. These criteria fit admin systems and campaign pages with charts; purely static display pages rarely need them.
6. Applicable scenarios and boundaries
Situations that need handling: the error keeps appearing in the console in development mode, appears intermittently when switching pages or opening modals, or the page includes third-party components that need real dimensions. If these are left unhandled, they will keep interfering with judgment when features are added later.
Situations that can be left alone: the error comes only from a known purely visual piece of logic that will be one cycle late, and it has been confirmed not to affect business values; or this logic is about to be refactored away in an upcoming redesign. If left alone, leave a one-line explanation in the code so it does not become red text that nobody dares to touch.
Situations where it does not apply or is not recommended: for a monolithic admin system with fewer than a few dozen pages and no complex animations, moving the timing plus adding a few computed values is usually enough; there is no need to introduce a full state-management overhaul for this. It is also not recommended to stuff business decisions into delayed callbacks just to keep the console quiet.
FAQ
Does this error also appear in production?
No. The second verification runs only in development builds and is not executed in production; however, the synchronous value-changing logic that caused it is still there and may show up as layout jumps or value deviations.
Adding a setTimeout makes it disappear, so why is that still not a good fix?
It pushes the change to the next cycle; the error is gone, but there is an extra render. Size-measurement and animation scenarios can flicker, and it can hide the real dependency-order problem.
Will changing only one width inside ngAfterViewInit also trigger it?
Yes. As long as this width participates in a template binding and is written after the same check has ended, the before and after values will not match during verification and the error will be thrown; the size of the value does not matter.
Will switching to signals prevent this from happening?
It will happen less often. Signals make dependencies clearer, but synchronously writing another signal inside an effect, or changing a bound value in an after-render callback, can still hit the same type of problem.
If this error is left unhandled, will it affect production functionality?
In most cases it does not directly break functionality, but it may cause first-screen layout flicker or a one-time size miscalculation. If the value causing it participates in business decisions, it cannot be delayed; the data flow needs to change.
Next time the console shows this error again, go through “who changed it, when it was changed, and whether it can wait one cycle” first, then decide whether to move the timing or change the data flow. Be clear about the boundary as well: purely visual measured values can wait one cycle; values that participate in business decisions cannot. It is better to calculate them before the data enters the component. This experience fits admin systems and corporate website projects; purely static display pages rarely need it.
-
H5 first screen filled with vh: why does the whole page jolt when the mobile address bar hides and shows, and how does 100vh differ from screen height?
Date: Nov 29, 2026 Read: 1
-
2026: Uni-app Mini Program says the main package exceeds 2M on submit—there are only a few pages, so what is actually taking up the size?
Date: Nov 28, 2026 Read: 8
-
It's 2026—why does a Flutter product feed get hotter the further you scroll, then cool down after leaving and re-entering? How many times are those images decoded?
Date: Nov 27, 2026 Read: 12
-
In 2026, list pages only append cards after scrolling to the second screen—Baidu's source contains not a single detail link; is the crawler simply not scrolling down for you?
Date: Nov 26, 2026 Read: 19
-
If a user leaves an admin tab open all day and the menu goes blank after an evening release, can the frontend know the old JS has already been replaced?
Date: Nov 24, 2026 Read: 43




