Property 'withComponents' does not exist on type 'typeof AgGridModule'
Asked Answered
I

1

15

I am using AG Grid in my Angular application and since upgrading from v27 to v28 I get the following error in my app.

Error: src/app/app.module.ts:18:18 - error TS2339: Property 'withComponents' does not exist on type 'typeof AgGridModule'.

I thought this was required when providing your own custom components to AG grid?

Interdict answered 6/7, 2022 at 9:35 Comment(0)
I
30

Since v28 the AgGridModule no longer needs the .withComponents() method as all user applications will now be using Ivy. The method used to handle registering custom components as EntryComponents but that is no longer required with Ivy and was deprecated by Angular.

So to fix this error make the follow change and your custom components will still work.

- AgGridModule.withComponents([CustomComp]);
+ AgGridModule

See the AG Grid Docs on Angular Compatibility for more details.

Interdict answered 6/7, 2022 at 9:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.