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

[Help] Router Module forRoot Issue with Module Federation #3852

Open
dassum03-BH opened this issue May 8, 2024 · 1 comment
Open

[Help] Router Module forRoot Issue with Module Federation #3852

dassum03-BH opened this issue May 8, 2024 · 1 comment

Comments

@dassum03-BH
Copy link

Hi @ScriptedAlchemy,

Shell app using Angular v16, MFE using Angular v15..

MFE has routing module with forRoot():

@NgModule({ imports: [RouterModule.forRoot(routes)], exports: [RouterModule] }) export class AppRoutingModule { }

This module is part of exposed standalone component

@Component({ standalone: true, imports: [ AppRoutingModule, SharedModule, BrowserModule, BrowserAnimationsModule, CoreModule ], providers: [ IconService, { provide: APP_INITIALIZER, useFactory: appInitializerFactory, deps: [TranslateService, Injector], multi: true } ], selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'] })

Getting error: NG04007: The Router was provided more than once. This can happen if 'forRoot' is used outside of the root injector. Lazy loaded modules should use RouterModule.forChild() instead.

Tried setting forChild with the routing module but that fails with the MFE.

Some help appreciated, thanks!

@ScriptedAlchemy
Copy link
Member

I dont know angular well. You can try contacting Manfred or @zackarychapple @valorkin who know angular much better than myself

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

No branches or pull requests

2 participants