Garmaine Staff asked 3 months ago

Suppose we package an Angular built web component created with @angular/elements and the Angular Package Format to NPM and we call it @ngx/my-custom-element.

It's used like this:

<my-custom-element></my-custom-element>

We now want to use this in another Angular project.

Assuming we do all the Web Component scaffolding that's required for Angular, can we then just import the component like this in app.component.ts:

import '@ngx/my-custom-element';

And use it in the Angular project within any component template like this:

<my-custom-element></my-custom-element>

This seems to be the case with the @vadeen library showcased in this article:

https://vaadin.com/learn/tutorials/using-web-components-in-angular

It seems like it should be possible. Just want to see if I'm missing anything before I attempt it.