NullInjectorError: No Provider for MatDialog Scroll Strategy After Setting Up Native Federation in Angular 18 Nx Monorepo #680
Labels
project:native-federation
status:reproducible-stackblitz-requested
We require a reproducible stackblitz.
With what library do you have an issue?
native-federation
Reproduction of the bug/regression with instructions
I am working with an Angular 18 application inside an Nx monorepo, and I've configured Angular Material (version 16) for UI components, specifically using MatDialog for dialogs.
To set up native federation, I ran the following command:
ng add @angular-architects/native-federation --project mfe1 --port 4201 --type remote
After running this command to configure the app as a remote module, the application broke with the following error:
NullInjectorError: No provider for InjectionToken mat-dialog-scroll-strategy!
It seems that the MatDialog scroll strategy is not properly injected after configuring the app for native federation. This issue only occurs after applying the native federation setup.
Steps to Reproduce:
Set up an Angular 18 application inside an Nx monorepo.
Install and configure Angular Material (version 16).
Add native federation with the following command:
ng add @angular-architects/native-federation --project mfe1 --port 4201 --type remote
Attempt to use MatDialog in the application.
Expected behavior
The MatDialog should work as expected, without any provider injection errors.
Versions of Native/Module Federation, Angular, Node, Browser, and operating system
Angular version: 18.2.0
Angular Material version: 16.2.14
Nx Monorepo: 20.0.0
Native federation version: 18.2.2
Other information
No response
I would be willing to submit a PR to fix this issue
The text was updated successfully, but these errors were encountered: