Yes, it is possible. In a micro-frontend architecture, a shell (host) application loads and composes several independently built micro-frontends, and one micro-frontend can navigate to or embed another through the shell. Common approaches in Angular 1. Module Federation / Native Federation - With Webpack Module Federation (@angular-architects/module-federation) or the esbuild-friendly Native Federation (@angular-architects/native-federation), each micro-frontend exposes components or routes as "remotes". - The shell (or another remote) loads them at runtime: { path: 'orders', loadChildren: () => loadRemoteModule({ remoteName: 'orders', exposedModule: './routes' }).then(m => m.ORDER_ROUTES) } - From the running micro-frontend you can then navigate to '/orders' with the router, or dynamically load an exposed component and render it inside your page with ViewContainerRef.createComponent. 2. Web Components (Angular Elements) - Package a micro-frontend as a custom element with createCustomElement. Any page — Angular, React or plain HTML — can use <orders-widget customer-id="42"></orders-widget> once its script is loaded. This works well across frameworks and versions. 3. Iframes - Strong isolation but limited integration (communication via postMessage, separate styles and routing). Suitable for legacy or third-party apps. Communication between micro-frontends - Keep it loose: URL and query parameters, custom DOM events (CustomEvent on window), a small shared event bus, or shared state exposed by the shell. Avoid tight coupling through shared internal services. Practical concerns - Share framework dependencies (Angular, RxJS) as singletons with compatible versions to avoid loading Angular twice. - Handle failures: if a remote cannot load, show a fallback instead of breaking the page. - Keep a consistent design system and authentication handled by the shell. - Version contracts (exposed modules, inputs and events) like APIs.
Ravindra Wadile · · 0 likes