Hey,
We're upgrading to angular 21 / esbuild and we've got trouble upgrading flexmonster.
The ngx-flexmonster npm package (latest version 2.9.128, published 2026-04-27) is compiled using Angular 14.3.0 partial compilation. This causes a runtime NG0203 error when used in an Angular 21 application and our reports won't load.
The error originates from the linker processing the Angular 14 partial declarations at build time, producing code that is incompatible with Angular 21's injection context.
Is there another way to make flexmonster work with Angular 21 ?
Best regards
Nans
Hello, Nans,
Thank you for reporting this issue.
We reviewed your request and investigated the NG0203 error in detail. Based on our research and testing, this issue is not caused by the Angular 14 dependency used in the ngx-flexmonster wrapper. We also could not reproduce the issue on our sample project, which currently uses Angular 21:
https://github.com/flexmonster/ngx-flexmonster
According to Angular's documentation, the NG0203 error occurs when calling the inject() method outside Angular's injection context. Additionally, this error can occur not only with explicit inject() calls, but also with Angular APIs that call inject() internally. In the context of Flexmonster, all of its event callbacks (ready, dataloaded, reportcomplete, etc.) and input callbacks (customizeCell, customizeContextMenu, etc.) are invoked outside the injection context, which could cause this issue.
The ngx-flexmonster wrapper source code does not use Angular's inject() API internally. Because of this, the error is unlikely to originate from the wrapper implementation itself.
To fix this issue, we recommend either using Angular's inject() in the injectable context (for instance, as a field initializer):
private service = inject(CustomService);
Alternatively, you could wrap the code using inject() inside the runInInjectionContext:
runInInjectionContext(this.injector, () => {
const service = inject(CustomService);
service.useService();
});
If this does not resolve the issue or your situation is different, feel free to reach out with a minimal code snippet reproducing the error. Our team would be glad to assist you and investigate further.
We are looking forward to hearing from you.
Best regards,
Maksym
Hi Maksym,
Thanks for your response. Howerver, there's a formatting issue in the code mentionned. Can you fix it ?
Best regards,
Nans
Hello, Nans,
Thank you for pointing this out, and apologies for the formatting issue in the previous reply.
We have fixed the code formatting in our response and look forward to hearing your feedback.
Best regards,
Maskym