how to use Angular-Slickgrid as a Standalone Component with Angular 18 #1413
-
I am implementing it without app.module.ts |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 14 replies
-
can you share a repro of what you tried so far? I've just updated to v18 but got it working since 16 or so |
Beta Was this translation helpful? Give feedback.
-
I personally never tried the standalone approach so I can't really provide much guidance on the matter (running the Angular 18 upgrade script also didn't remove the if you give it a try and it works, please let me know or even better please contribute a PR to update the Quick Start docs with relevant info. One thing to note in all of this is that |
Beta Was this translation helpful? Give feedback.
-
Hi lajith,
You need to import both AngularGridInstance and AngularSlickgridModule within the component where the slickGrid is used.
Also in your app.config.ts. Use the below instead of your below codes.
importProvidersFrom(AngularSlickgridModule.forRoot())
I hope this helps and good luck.
Phi
…________________________________
From: lajith111 ***@***.***>
Sent: 23 August 2024 09:32
To: ghiscoding/Angular-Slickgrid ***@***.***>
Cc: Phingn ***@***.***>; Mention ***@***.***>
Subject: Re: [ghiscoding/Angular-Slickgrid] how to use Angular-Slickgrid as a Standalone Component with Angular 18 (Discussion #1413)
@ghiscoding<https://github.com/ghiscoding> i have upgraded my app module to standalone (v18)
in app.config i have update
importProvidersFrom(AngularSlickgridModule.forRoot({
externalResources: [new ExcelExportService()]
)
But i am getting compile time error
Cannot create an instance of an abstract class.ts(2511)
(alias) abstract new ExcelExportService(): ExcelExportService
import ExcelExportService
iIn compont class it is working fine
this.gridOptions = {
excelExportOptions:{
sanitizeDataExport: true,
filename:'AccountReport_'+ new Date().toJSON().slice(0,10),
exportWithFormatter:true,
},
externalResources: [new ExcelExportService()],
}
—
Reply to this email directly, view it on GitHub<#1413 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/APFKRU446DCUKVDAZTOR7CTZS3XSFAVCNFSM6AAAAABIHK3DB6VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANBSG43TCOA>.
You are receiving this because you were mentioned.
|
Beta Was this translation helpful? Give feedback.
-
In component class ot is working fine.. only issue with app.config. Not able to register extrrnal service (excel export) in app.config |
Beta Was this translation helpful? Give feedback.
-
Did you use this line of code instead of yours original codes in the app.config.ts?
importProvidersFrom(AngularSlickgridModule.forRoot())
…________________________________
From: lajith111 ***@***.***>
Sent: 23 August 2024 14:10
To: ghiscoding/Angular-Slickgrid ***@***.***>
Cc: Phingn ***@***.***>; Mention ***@***.***>
Subject: Re: [ghiscoding/Angular-Slickgrid] how to use Angular-Slickgrid as a Standalone Component with Angular 18 (Discussion #1413)
In component class ot is working fine.. only issue with app.config. Not able to register extrrnal service (excel export) in app.config
—
Reply to this email directly, view it on GitHub<#1413 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/APFKRU4AHF7GEF2GV4ALJ2LZS4YFFAVCNFSM6AAAAABIHK3DB6VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANBTGAZTONY>.
You are receiving this because you were mentioned.
|
Beta Was this translation helpful? Give feedback.
I personally never tried the standalone approach so I can't really provide much guidance on the matter (running the Angular 18 upgrade script also didn't remove the
app.module
that I still have either)... however, I went to Stack Overflow and someone posted today a really detailed answer for Angular 18 that seems to show both approach including a Standalone version, see this SO (there's even a Stackblitz provided)https://stackoverflow.com/a/78527155/1212166
if you give it a try and it works, please let me know or even better please contribute a PR to update the Quick Start docs with relevant info.
One thing to note in all of this is that
AngularSlickgridModule.forRoot()
is always needed,…