[Help] Router Module forRoot Issue with Module Federation
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!
I dont know angular well. You can try contacting Manfred or @zackarychapple @valorkin who know angular much better than myself