# Error "Cannot Read Properties of Undefined (reading 'index')" in Grid

## Environment

<table>
    <tbody>
	    <tr>
	    	<td>Product</td>
	    	<td>Progress® Kendo UI for Angular Grid</td>
	    </tr>
    </tbody>
</table>

## Description

I encounter the error `Cannot read properties of undefined (reading 'index')` after updating my Angular app to v21. The error originates from `ScrollerService2.onScroll` in the Grid component.

## Cause

Angular v21 enables zoneless mode by default, which affects some Kendo UI for Angular components. The Kendo UI for Angular components currently [do not support zoneless mode](https://www.telerik.com/kendo-angular-ui/components/faq#do-kendo-angular-components-work-with-zoneless-change-detection). This mismatch triggers the error during certain operations like scrolling.

## Solution

To resolve the issue, follow these steps to disable zoneless mode:

1. Install `zone.js` using npm:

   ```bash
   npm install zone.js
   ```

2. Add `zone.js` to the `polyfills` section of the `angular.json` file:

   ```json
   "styles": [
     "src/styles.css"
   ],
   "polyfills": [
     "@angular/localize/init",
     "zone.js"
   ]
   ```

3. Update the `app.config.ts` file to include the [`provideZoneChangeDetection`](https://angular.dev/api/core/provideZoneChangeDetection) function:

   ```typescript
   import {ApplicationConfig, importProvidersFrom, provideBrowserGlobalErrorListeners, provideZoneChangeDetection} from '@angular/core';
   import { provideRouter } from '@angular/router';
   import { provideAnimations } from '@angular/platform-browser/animations';
   import { routes } from './app.routes';

   export const appConfig: ApplicationConfig = {
     providers: [
       provideBrowserGlobalErrorListeners(),
       provideRouter(routes),
       provideZoneChangeDetection({ eventCoalescing: true }),
       provideAnimations()
     ],
   };
   ```

After you complete these steps, the `Cannot read properties of undefined (reading 'index')` error in the Kendo UI for Angular Grid is resolved.

## See Also

* [Kendo UI for Angular Grid Documentation](https://www.telerik.com/kendo-angular-ui/components/grid)
* [Kendo UI for Angular FAQ on Zoneless Support](https://www.telerik.com/kendo-angular-ui/components/faq#do-kendo-angular-components-work-with-zoneless-change-detection)
* [Angular v21 Zoneless Change Detection](https://angular.dev/guide/zoneless)
