Text of v20.angular.dev › errors › NG0956 as Styx crawled it on Nov 19, 2026. The page may have changed since. Only its words are kept, without pictures or layout.

Open the live page

NG0956: Tracking expression caused re-creation of the DOM structure. • Angular

Roadmap Get involved Versioning and releases Version compatibility Update guide Overview NG0100: Expression Changed After Checked NG01101: Wrong Async Validator Return Type NG01203: Missing value accessor NG0200: Circular Dependency in DI NG0201: No Provider Found NG0203: `inject()` must be called from an injection context NG0209: Invalid multi provider NG02200: Missing Iterable Differ NG02800: JSONP support in HttpClient configuration NG02802: Headers not transferred by HttpTransferCache NG0300: Selector Collision NG0301: Export Not Found NG0302: Pipe Not Found NG0401: Missing Platform NG0403: Bootstrapped NgModule doesn't specify which component to initialize NG0500: Hydration Node Mismatch NG05000: Hydration with unsupported Zone.js instance NG0501: Hydration Missing Siblings NG0502: Hydration Missing Node NG0503: Hydration Unsupported Projection of DOM Nodes NG0504: Skip hydration flag is applied to an invalid node NG0505: No hydration info in server response NG0506: Application remains unstable NG0507: HTML content was altered after server-side rendering NG05104: Root element was not found NG0602: Disallowed function call inside reactive context NG0750: @defer dependencies failed to load NG0751: @defer behavior when HMR is enabled NG0910: Unsafe bindings on an iframe element NG0912: Component ID generation collision NG0913: Runtime Performance Warnings NG0950: Required input is accessed before a value is set.

NG0951: Child query result is required but no value is available. NG0955: Track expression resulted in duplicated keys for a given collection. NG0956: Tracking expression caused re-creation of the DOM structure. NG1001: Argument Not Literal NG2003: Missing Token NG2009: Invalid Shadow DOM selector NG3003: Import Cycle Detected NG6100: NgModule.id Set to module.id anti-pattern NG8001: Invalid Element NG8002: Invalid Attribute NG8003: Missing Reference Target The identity track expression specified in the @for loop caused re-creation of the DOM corresponding to all items.

This is a very expensive operation that commonly occurs when working with immutable data structures. For example: @ Component ({ template: ` <button (click)="toggleAllDone()">All done!</button> <ul> @for (todo of todos; track todo) { <li>{{todo.task}}</li> } </ul> ` , }) export class App { todos = [ { id: 0 , task: 'understand trackBy' , done: false }, { id: 1 , task: 'use proper tracking expression' , done: false }, ]; toggleAllDone () { this .todos = this .todos. map ( todo => ({ ... todo, done: true })); } } In the provided example, the entire list with all the views (DOM nodes, Angular directives, components, queries, etc.) are re-created (!) after toggling the "done" status of items.

Here, a relatively inexpensive binding update to the done property would suffice. Apart from having a high performance penalty, re-creating the DOM tree results in loss of state in the DOM elements (ex.: focus, text selection, sites loaded in an iframe, etc.). Fixing the error Change the tracking expression such that it uniquely identifies an item in a collection, regardless of its object identity. In the discussed example, the correct track expression would use the unique id property ( item.id ): @ Component ({ template: ` <button (click)="toggleAllDone()">All done!</button> <ul> @for (todo of todos; track todo.id) { <li>{{todo.task}}</li> } </ul> ` , }) export class App { todos = [ { id: 0 , task: 'understand trackBy' , done: false }, { id: 1 , task: 'use proper tracking expression' , done: false }, ]; toggleAllDone () { this .todos = this .todos. map ( todo => ({ ... todo, done: true })); } }