angular-architects / module-federation-plugin

MIT License
730 stars 199 forks source link

How to display two MFEs on a single page #312

Open sahithiKondapalli opened 1 year ago

sahithiKondapalli commented 1 year ago

I am using angular-architects/module-federation 15.0.3 version. I want to load two mfe components from two different mfes on a single page.

thiagopg84 commented 1 year ago

I was wondering the same thing.

geraldcsoftware commented 1 year ago

You can use named router outlets to render the components, and follow the guide to lazy loading a component from a remote module for both router-outlets.

export const appRoutes: Route[] = [ { path: '', outlet: 'head', loadComponent: () => loadRemoteModule(...).then((m) => m.AppComponent), }, { path: '', outlet: 'content', loadComponent: () => loadRemoteModule(...).then((m) => m.AppComponent), } ];

Here is a simplified version of achieving this.