Aurelia 2 component running in angular

Hi All

I am being asked whether an aurelia 2 component can run inside an angular 11 app, are aurelia vnext components standard web components. I see they are shadow dom’d but are they true web components

If they are not standard web components can I use this written by @bigopon which I think is intended for v1 only

Looks like there is some code for web component registration in aurelia 2

1 Like

Aurelia components are not web components. There’s a way to bridge the systems, so that whenever you do create a HTML element, it would automatically hydrate and connect.
The v1 plugin isn’t compatible for v2, maybe I’ll create a separate plugin first before we have an official plugin for v2.

For your main question:

whether an aurelia 2 component can run inside an angular 11 app

Yes, there’ at least two ways:

  1. render an Aurelia app. All it requires is a host element and a root component. This means in the Angular app, you will get some element reference, and instantiate an Aurelia app with this element as host.
  2. As you notice, if you want to simplify the process of creating an element, any do not want to instantiate Aurelia apps in many places, you can use native web component to do this.

Note that both approaches above require the Aurelia runtime to be brought in, which means it will increase the bundle size of your application.


Thanks bigopon

Just been looking through the code for the aurelia web component plugin so looks like the magic is done by building the aurelia component on the client and then converting it too web component looks like the same is true of angular elements.

As for the 2 options I think option 1 sounds messy for including things like text controls etc but was considering that option for micro front end, so agree vanilla web components seems like a better option, our team need to have another think about our approach I think

Thanks again for being so helpful