Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullInjectorError: No Provider for MatDialog Scroll Strategy After Setting Up Native Federation in Angular 18 Nx Monorepo #680

Open
2 tasks done
amitkumartech opened this issue Oct 23, 2024 · 1 comment

Comments

@amitkumartech
Copy link

amitkumartech commented Oct 23, 2024

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

  • Yes
  • No
@rainerhahnekamp
Copy link
Collaborator

@amitkumartech we've created a stackblitz example that helps us speeding up the support. But you would have to come with a reproducible example please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants