Can AngularJS function as a micro frontend within an Angular container?

I’m looking into breaking up our big front-end app into smaller parts. Most guides talk about slowly replacing AngularJS bits with newer Angular stuff. But that’s not what we want right now.

We’re thinking of having our main app in Angular 8. It would handle things like menus, logging in, and the overall layout. Then we want to put our old AngularJS app inside this new Angular 8 app, kind of like a widget.

Is this doable? If so, how would we go about it? We don’t want to spend time changing all our AngularJS code to Angular 8 yet. We just want them to work together somehow.

Has anyone tried something like this before? Any tips or tricks would be super helpful!

yep, it’s doable! i’ve seen teams use ngUpgrade to embed angularJS stuff in angular apps. it’s not perfect but it works. you’ll need to fiddle with routing and data sharing between the old and new parts. just be ready for some quirks and performance hiccups. good luck with ur project!

Yes, it’s possible to use AngularJS as a micro frontend within an Angular container, though it requires careful planning. One approach is to use Angular’s custom elements to wrap your AngularJS application. This allows you to encapsulate the AngularJS code and use it as a web component within your Angular 8 app.

You’ll need to set up a build process that compiles your AngularJS app into a single bundle. Then, create a custom element in Angular that loads this bundle and bootstraps the AngularJS app within its shadow DOM. This method maintains isolation between the two frameworks and allows them to coexist.

Keep in mind that this approach may introduce some performance overhead and complexity in state management between the two parts of your application. It’s a temporary solution, but it can buy you time to gradually migrate your AngularJS code to Angular when you’re ready.

ooh, interesting idea! have u considered using iframe to embed the angularJS app? It might be simpler than custom elements. But ya gotta watch out for communication between the two. Maybe use postMessage? Just brainstorming here. What other options hav u explored? curious to hear more bout ur project!